diff options
| -rw-r--r-- | mm/slob.c | 5 | ||||
| -rw-r--r-- | mm/slub.c | 6 |
2 files changed, 9 insertions, 2 deletions
| @@ -60,6 +60,7 @@ | |||
| 60 | #include <linux/kernel.h> | 60 | #include <linux/kernel.h> |
| 61 | #include <linux/slab.h> | 61 | #include <linux/slab.h> |
| 62 | #include <linux/mm.h> | 62 | #include <linux/mm.h> |
| 63 | #include <linux/swap.h> /* struct reclaim_state */ | ||
| 63 | #include <linux/cache.h> | 64 | #include <linux/cache.h> |
| 64 | #include <linux/init.h> | 65 | #include <linux/init.h> |
| 65 | #include <linux/module.h> | 66 | #include <linux/module.h> |
| @@ -255,6 +256,8 @@ static void *slob_new_pages(gfp_t gfp, int order, int node) | |||
| 255 | 256 | ||
| 256 | static void slob_free_pages(void *b, int order) | 257 | static void slob_free_pages(void *b, int order) |
| 257 | { | 258 | { |
| 259 | if (current->reclaim_state) | ||
| 260 | current->reclaim_state->reclaimed_slab += 1 << order; | ||
| 258 | free_pages((unsigned long)b, order); | 261 | free_pages((unsigned long)b, order); |
| 259 | } | 262 | } |
| 260 | 263 | ||
| @@ -407,7 +410,7 @@ static void slob_free(void *block, int size) | |||
| 407 | spin_unlock_irqrestore(&slob_lock, flags); | 410 | spin_unlock_irqrestore(&slob_lock, flags); |
| 408 | clear_slob_page(sp); | 411 | clear_slob_page(sp); |
| 409 | free_slob_page(sp); | 412 | free_slob_page(sp); |
| 410 | free_page((unsigned long)b); | 413 | slob_free_pages(b, 0); |
| 411 | return; | 414 | return; |
| 412 | } | 415 | } |
| 413 | 416 | ||
| @@ -9,6 +9,7 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
| 12 | #include <linux/swap.h> /* struct reclaim_state */ | ||
| 12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| 13 | #include <linux/bit_spinlock.h> | 14 | #include <linux/bit_spinlock.h> |
| 14 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
| @@ -1170,6 +1171,8 @@ static void __free_slab(struct kmem_cache *s, struct page *page) | |||
| 1170 | 1171 | ||
| 1171 | __ClearPageSlab(page); | 1172 | __ClearPageSlab(page); |
| 1172 | reset_page_mapcount(page); | 1173 | reset_page_mapcount(page); |
| 1174 | if (current->reclaim_state) | ||
| 1175 | current->reclaim_state->reclaimed_slab += pages; | ||
| 1173 | __free_pages(page, order); | 1176 | __free_pages(page, order); |
| 1174 | } | 1177 | } |
| 1175 | 1178 | ||
| @@ -1909,7 +1912,7 @@ static inline int calculate_order(int size) | |||
| 1909 | * Doh this slab cannot be placed using slub_max_order. | 1912 | * Doh this slab cannot be placed using slub_max_order. |
| 1910 | */ | 1913 | */ |
| 1911 | order = slab_order(size, 1, MAX_ORDER, 1); | 1914 | order = slab_order(size, 1, MAX_ORDER, 1); |
| 1912 | if (order <= MAX_ORDER) | 1915 | if (order < MAX_ORDER) |
| 1913 | return order; | 1916 | return order; |
| 1914 | return -ENOSYS; | 1917 | return -ENOSYS; |
| 1915 | } | 1918 | } |
| @@ -2522,6 +2525,7 @@ __setup("slub_min_order=", setup_slub_min_order); | |||
| 2522 | static int __init setup_slub_max_order(char *str) | 2525 | static int __init setup_slub_max_order(char *str) |
| 2523 | { | 2526 | { |
| 2524 | get_option(&str, &slub_max_order); | 2527 | get_option(&str, &slub_max_order); |
| 2528 | slub_max_order = min(slub_max_order, MAX_ORDER - 1); | ||
| 2525 | 2529 | ||
| 2526 | return 1; | 2530 | return 1; |
| 2527 | } | 2531 | } |
