diff options
-rw-r--r-- | include/linux/slab.h | 1 | ||||
-rw-r--r-- | mm/slab.c | 13 |
2 files changed, 12 insertions, 2 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h index 2b28c849d75a..e2ee5b268797 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -46,6 +46,7 @@ typedef struct kmem_cache kmem_cache_t; | |||
46 | what is reclaimable later*/ | 46 | what is reclaimable later*/ |
47 | #define SLAB_PANIC 0x00040000UL /* panic if kmem_cache_create() fails */ | 47 | #define SLAB_PANIC 0x00040000UL /* panic if kmem_cache_create() fails */ |
48 | #define SLAB_DESTROY_BY_RCU 0x00080000UL /* defer freeing pages to RCU */ | 48 | #define SLAB_DESTROY_BY_RCU 0x00080000UL /* defer freeing pages to RCU */ |
49 | #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ | ||
49 | 50 | ||
50 | /* flags passed to a constructor func */ | 51 | /* flags passed to a constructor func */ |
51 | #define SLAB_CTOR_CONSTRUCTOR 0x001UL /* if not set, then deconstructor */ | 52 | #define SLAB_CTOR_CONSTRUCTOR 0x001UL /* if not set, then deconstructor */ |
@@ -94,6 +94,7 @@ | |||
94 | #include <linux/interrupt.h> | 94 | #include <linux/interrupt.h> |
95 | #include <linux/init.h> | 95 | #include <linux/init.h> |
96 | #include <linux/compiler.h> | 96 | #include <linux/compiler.h> |
97 | #include <linux/cpuset.h> | ||
97 | #include <linux/seq_file.h> | 98 | #include <linux/seq_file.h> |
98 | #include <linux/notifier.h> | 99 | #include <linux/notifier.h> |
99 | #include <linux/kallsyms.h> | 100 | #include <linux/kallsyms.h> |
@@ -173,12 +174,12 @@ | |||
173 | SLAB_CACHE_DMA | \ | 174 | SLAB_CACHE_DMA | \ |
174 | SLAB_MUST_HWCACHE_ALIGN | SLAB_STORE_USER | \ | 175 | SLAB_MUST_HWCACHE_ALIGN | SLAB_STORE_USER | \ |
175 | SLAB_RECLAIM_ACCOUNT | SLAB_PANIC | \ | 176 | SLAB_RECLAIM_ACCOUNT | SLAB_PANIC | \ |
176 | SLAB_DESTROY_BY_RCU) | 177 | SLAB_DESTROY_BY_RCU | SLAB_MEM_SPREAD) |
177 | #else | 178 | #else |
178 | # define CREATE_MASK (SLAB_HWCACHE_ALIGN | \ | 179 | # define CREATE_MASK (SLAB_HWCACHE_ALIGN | \ |
179 | SLAB_CACHE_DMA | SLAB_MUST_HWCACHE_ALIGN | \ | 180 | SLAB_CACHE_DMA | SLAB_MUST_HWCACHE_ALIGN | \ |
180 | SLAB_RECLAIM_ACCOUNT | SLAB_PANIC | \ | 181 | SLAB_RECLAIM_ACCOUNT | SLAB_PANIC | \ |
181 | SLAB_DESTROY_BY_RCU) | 182 | SLAB_DESTROY_BY_RCU | SLAB_MEM_SPREAD) |
182 | #endif | 183 | #endif |
183 | 184 | ||
184 | /* | 185 | /* |
@@ -2813,6 +2814,14 @@ static inline void *____cache_alloc(struct kmem_cache *cachep, gfp_t flags) | |||
2813 | if (nid != numa_node_id()) | 2814 | if (nid != numa_node_id()) |
2814 | return __cache_alloc_node(cachep, flags, nid); | 2815 | return __cache_alloc_node(cachep, flags, nid); |
2815 | } | 2816 | } |
2817 | if (unlikely(cpuset_do_slab_mem_spread() && | ||
2818 | (cachep->flags & SLAB_MEM_SPREAD) && | ||
2819 | !in_interrupt())) { | ||
2820 | int nid = cpuset_mem_spread_node(); | ||
2821 | |||
2822 | if (nid != numa_node_id()) | ||
2823 | return __cache_alloc_node(cachep, flags, nid); | ||
2824 | } | ||
2816 | #endif | 2825 | #endif |
2817 | 2826 | ||
2818 | check_irq_off(); | 2827 | check_irq_off(); |