diff options
| author | Wei Yang <richard.weiyang@gmail.com> | 2017-07-06 18:36:31 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-06 19:24:30 -0400 |
| commit | a93cf07bc3fb4e7bc924d33c387dabc85086ea38 (patch) | |
| tree | ed8c028af545abf8743afcff1000758cbd947d28 /include | |
| parent | d3111e6cce6001e71ddc4737d0d412c2300043a2 (diff) | |
mm/slub.c: wrap cpu_slab->partial in CONFIG_SLUB_CPU_PARTIAL
cpu_slab's field partial is used when CONFIG_SLUB_CPU_PARTIAL is set,
which means we can save a pointer's space on each cpu for every slub
item.
This patch wraps cpu_slab->partial in CONFIG_SLUB_CPU_PARTIAL and wraps
its sysfs use too.
[akpm@linux-foundation.org: avoid strange 80-col tricks]
Link: http://lkml.kernel.org/r/20170502144533.10729-3-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/slub_def.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 070ff84240e7..a3e9492fed02 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
| @@ -41,12 +41,31 @@ struct kmem_cache_cpu { | |||
| 41 | void **freelist; /* Pointer to next available object */ | 41 | void **freelist; /* Pointer to next available object */ |
| 42 | unsigned long tid; /* Globally unique transaction id */ | 42 | unsigned long tid; /* Globally unique transaction id */ |
| 43 | struct page *page; /* The slab from which we are allocating */ | 43 | struct page *page; /* The slab from which we are allocating */ |
| 44 | #ifdef CONFIG_SLUB_CPU_PARTIAL | ||
| 44 | struct page *partial; /* Partially allocated frozen slabs */ | 45 | struct page *partial; /* Partially allocated frozen slabs */ |
| 46 | #endif | ||
| 45 | #ifdef CONFIG_SLUB_STATS | 47 | #ifdef CONFIG_SLUB_STATS |
| 46 | unsigned stat[NR_SLUB_STAT_ITEMS]; | 48 | unsigned stat[NR_SLUB_STAT_ITEMS]; |
| 47 | #endif | 49 | #endif |
| 48 | }; | 50 | }; |
| 49 | 51 | ||
| 52 | #ifdef CONFIG_SLUB_CPU_PARTIAL | ||
| 53 | #define slub_percpu_partial(c) ((c)->partial) | ||
| 54 | |||
| 55 | #define slub_set_percpu_partial(c, p) \ | ||
| 56 | ({ \ | ||
| 57 | slub_percpu_partial(c) = (p)->next; \ | ||
| 58 | }) | ||
| 59 | |||
| 60 | #define slub_percpu_partial_read_once(c) READ_ONCE(slub_percpu_partial(c)) | ||
| 61 | #else | ||
| 62 | #define slub_percpu_partial(c) NULL | ||
| 63 | |||
| 64 | #define slub_set_percpu_partial(c, p) | ||
| 65 | |||
| 66 | #define slub_percpu_partial_read_once(c) NULL | ||
| 67 | #endif // CONFIG_SLUB_CPU_PARTIAL | ||
| 68 | |||
| 50 | /* | 69 | /* |
| 51 | * Word size structure that can be atomically updated or read and that | 70 | * Word size structure that can be atomically updated or read and that |
| 52 | * contains both the order and the number of objects that a slab of the | 71 | * contains both the order and the number of objects that a slab of the |
