SLEB: The Enhanced Slab Allocator
Subsystems (3)
cover SLEB: The Enhanced Slab Allocator
SLEB is a merging of SLUB with some queuing concepts from SLAB and a new way of managing objects in the slabs using bitmaps. It uses a percpu queue so that free operations can be properly buffered and a bitmap for managing the free/allocated state in the slabs. It is slightly more inefficient than SLUB (due to the need to place large bitmaps --sized a few words--in some slab pages if there are more than BITS_PER_LONG objects in a slab) but in general does compete well with SLUB in terms of space use.
The SLAB scheme of not touching the object during management is adopted. SLEB can efficiently free and allocate cache cold objects without causing cache misses.
There are numerous SLAB schemes that are not supported. Those could be added if needed and if they really make a difference.
WARNING: This only ran successfully using hackbench in a kvm instance so far.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 1/10 slab: Introduce a constant for a unspecified node.
kmalloc_node() and friends can be passed a constant -1 to indicate that no choice was made for the node from which the object needs to come.
Add a constant for this.
--- include/linux/slab.h | 2 ++ mm/slub.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-)
include/linux/slab.h +2 -0
@@ -92,6 +92,8 @@#define ZERO_OR_NULL_PTR (x) ((unsigned long)(x) <= \ (unsigned long)ZERO_SIZE_PTR) +#define SLAB_NODE_UNSPECIFIED (-1L) +/* * struct kmem_cache related prototypes */
mm/slub.c +5 -5
@@ -1081,7 +1081,7 @@ static inline struct page *alloc_slab_pa flags |= __GFP_NOTRACK; -if (node ==-1 ) +if (node ==SLAB_NODE_UNSPECIFIED )return alloc_pages (flags, order);else return alloc_pages_node (node, flags, order);
@@ -1731,7 +1731,7 @@ static __always_inline void *slab_alloc(void *kmem_cache_alloc (struct kmem_cache *s,gfp_t gfpflags) { -void *ret =slab_alloc (s, gfpflags,-1 , _RET_IP_); +void *ret =slab_alloc (s, gfpflags,SLAB_NODE_UNSPECIFIED , _RET_IP_);trace_kmem_cache_alloc (_RET_IP_, ret, s->objsize, s->size, gfpflags);
@@ -1742,7 +1742,7 @@ EXPORT_SYMBOL(kmem_cache_alloc);#ifdef CONFIG_TRACING void *kmem_cache_alloc_notrace (struct kmem_cache *s,gfp_t gfpflags) { -return slab_alloc (s, gfpflags,-1 , _RET_IP_); +return slab_alloc (s, gfpflags,SLAB_NODE_UNSPECIFIED , _RET_IP_); }EXPORT_SYMBOL (kmem_cache_alloc_notrace);#endif
@@ -2740,7 +2740,7 @@ void *__kmalloc(size_t size, gfp_t flagsif (unlikely (ZERO_OR_NULL_PTR (s)))return s; - ret =slab_alloc (s, flags,-1 , _RET_IP_); + ret =slab_alloc (s, flags,SLAB_NODE_UNSPECIFIED , _RET_IP_);trace_kmalloc (_RET_IP_, ret, size, s->size, flags);
@@ -3324,7 +3324,7 @@ void *__kmalloc_track_caller(size_t sizeif (unlikely (ZERO_OR_NULL_PTR (s)))return s; - ret =slab_alloc (s, gfpflags,-1 , caller); + ret =slab_alloc (s, gfpflags,SLAB_NODE_UNSPECIFIED , caller);/* Honor the call site pointer we recieved. */ trace_kmalloc (caller, ret, size, s->size, gfpflags);
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 2/10 SLUB: Constants need UL
In reply to Christoph LameterUL suffix is missing in some constants. Conform to how slab.h uses constants.
--- mm/slub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/slub.c +2 -2
@@ -170,8 +170,8 @@#define MAX_OBJS_PER_PAGE 65535/* since page.objects is u16 */ /* Internal SLUB flags */ -#define __OBJECT_POISON 0x80000000/* Poison object */ -#define __SYSFS_ADD_DEFERRED 0x40000000/* Not yet visible via sysfs */ +#define __OBJECT_POISON 0x80000000UL/* Poison object */ +#define __SYSFS_ADD_DEFERRED 0x40000000UL/* Not yet visible via sysfs */ static int kmem_size =sizeof (struct kmem_cache );
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 3/10 SLUB: Use kmem_cache flags to detect if Slab is in debugging mode.
In reply to Christoph LameterThe cacheline with the flags is reachable from the hot paths after the percpu allocator changes went in. So there is no need anymore to put a flag into each slab page. Get rid of the SlubDebug flag and use the flags in kmem_cache instead.
--- include/linux/page-flags.h | 1 - mm/slub.c | 33 ++++++++++++--------------------- 2 files changed, 12 insertions(+), 22 deletions(-)
include/linux/page-flags.h +0 -1
@@ -215,7 +215,6 @@ PAGEFLAG(SwapBacked, swapbacked) __CLEAR __PAGEFLAG(SlobFree, slob_free)__PAGEFLAG (SlubFrozen, slub_frozen) -__PAGEFLAG (SlubDebug, slub_debug)/* * Private page markings that may be used by the filesystem that owns the page
mm/slub.c +12 -21
@@ -107,11 +107,17 @@* the fast path and disables lockless freelists. */ +#define SLAB_DEBUG_FLAGS (SLAB_RED_ZONE | SLAB_POISON | SLAB_STORE_USER | \ + SLAB_TRACE | SLAB_DEBUG_FREE) + +static inline int debug_on (struct kmem_cache *s) +{#ifdef CONFIG_SLUB_DEBUG -#define SLABDEBUG 1 +return unlikely (s->flags &SLAB_DEBUG_FLAGS );#else -#define SLABDEBUG 0 +return 0 ;#endif +}/* * Issues still to be resolved:
@@ -1165,9 +1171,6 @@ static struct page *new_slab(struct kmeminc_slabs_node (s,page_to_nid (page), page->objects); page->slab = s; page->flags |=1 << PG_slab; -if (s->flags & (SLAB_DEBUG_FREE |SLAB_RED_ZONE |SLAB_POISON | -SLAB_STORE_USER |SLAB_TRACE )) -__SetPageSlubDebug (page); start =page_address (page);
@@ -1194,14 +1197,13 @@ static void __free_slab(struct kmem_cachint order =compound_order (page);int pages =1 << order; -if (unlikely (SLABDEBUG &&PageSlubDebug (page))) { +if (debug_on (s)) {void *p;slab_pad_check (s, page);for_each_object (p, s,page_address (page), page->objects)check_object (s, page, p,0 ); -__ClearPageSlubDebug (page); }kmemcheck_free_shadow (page,compound_order (page));
@@ -1419,8 +1421,7 @@ static void unfreeze_slab(struct kmem_castat (s, tail ?DEACTIVATE_TO_TAIL :DEACTIVATE_TO_HEAD ); }else {stat (s,DEACTIVATE_FULL ); -if (SLABDEBUG &&PageSlubDebug (page) && - (s->flags &SLAB_STORE_USER )) +if (debug_on (s) && (s->flags &SLAB_STORE_USER ))add_full (n, page); }slab_unlock (page);
@@ -1628,7 +1629,7 @@ load_freelist: object = c->page->freelist;if (unlikely (!object)) goto another_slab; -if (unlikely (SLABDEBUG &&PageSlubDebug (c->page))) +if (debug_on (s)) goto debug; c->freelist =get_freepointer (s, object);
@@ -1787,7 +1788,7 @@ static void __slab_free(struct kmem_cachstat (s,FREE_SLOWPATH );slab_lock (page); -if (unlikely (SLABDEBUG &&PageSlubDebug (page))) +if (debug_on (s)) goto debug; checks_ok:
@@ -3400,16 +3401,6 @@ static void validate_slab_slab(struct km }else printk (KERN_INFO "SLUB %s: Skipped busy slab 0x%p\n" , s->name, page); - -if (s->flags &DEBUG_DEFAULT_FLAGS ) { -if (!PageSlubDebug (page)) -printk (KERN_ERR "SLUB %s: SlubDebug not set " -"on slab 0x%p\n" , s->name, page); - }else { -if (PageSlubDebug (page)) -printk (KERN_ERR "SLUB %s: SlubDebug set on " -"slab 0x%p\n" , s->name, page); - } } static int validate_slab_node(struct kmem_cache *s,
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 4/10 SLUB: discard_slab_unlock
In reply to Christoph LameterThe sequence of unlocking a slab and freeing it occurs multiple times.
--- mm/slub.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
mm/slub.c +10 -6
@@ -1268,6 +1268,13 @@ static __always_inline int slab_trylock(return rc; } +static void discard_slab_unlock (struct kmem_cache *s, +struct page *page) +{ +slab_unlock (page); +discard_slab (s, page); +} +/* * Management of partially allocated slabs */
@@ -1441,9 +1448,8 @@ static void unfreeze_slab(struct kmem_caadd_partial (n, page,1 );slab_unlock (page); }else { -slab_unlock (page);stat (s,FREE_SLAB ); -discard_slab (s, page); +discard_slab_unlock (s, page); } } }
@@ -1826,9 +1832,8 @@ slab_empty:remove_partial (s, page);stat (s,FREE_REMOVE_PARTIAL ); } -slab_unlock (page);stat (s,FREE_SLAB ); -discard_slab (s, page); +discard_slab_unlock (s, page);return ; debug:
@@ -2905,8 +2910,7 @@ int kmem_cache_shrink(struct kmem_cache*/ list_del (&page->lru); n->nr_partial--; -slab_unlock (page); -discard_slab (s, page); +discard_slab_unlock (s, page); }else {list_move (&page->lru, slabs_by_inuse + page->inuse);
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 5/10 SLUB: is_kmalloc_cache
In reply to Christoph LameterThe determination if a slab is occurring multiple times.
--- mm/slub.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
mm/slub.c +7 -3
@@ -312,6 +312,11 @@ static inline int oo_objects(struct kmemreturn x.x &OO_MASK ; } +static int is_kmalloc_cache (struct kmem_cache *s) +{ +return (s < kmalloc_caches +KMALLOC_CACHES && s >= kmalloc_caches); +} +#ifdef CONFIG_SLUB_DEBUG /* * Debug settings:
@@ -2076,7 +2081,7 @@ static DEFINE_PER_CPU(struct kmem_cache_static inline int alloc_kmem_cache_cpus (struct kmem_cache *s,gfp_t flags) { -if (s < kmalloc_caches +KMALLOC_CACHES && s >= kmalloc_caches) +if (is_kmalloc_cache (s))/* * Boot time creation of the kmalloc array. Use static per cpu data * since the per cpu allocator is not available yet.
@@ -2158,8 +2163,7 @@ static int init_kmem_cache_nodes(structint node;int local_node; -if (slab_state >=UP && (s < kmalloc_caches || - s >= kmalloc_caches +KMALLOC_CACHES )) +if (slab_state >=UP && !is_kmalloc_cache (s)) local_node =page_to_nid (virt_to_page (s));else local_node =0 ;
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 6/10 SLEB: The Enhanced Slab Allocator
In reply to Christoph LameterSLEB is a merging of SLUB with some queuing concepts from SLAB and a new way of managing objects in the slabs using bitmaps. It uses a percpu queue so that free operations can be properly buffered and a bitmap for managing the free/allocated state in the slabs. It is slightly more inefficient than SLUB (due to the need to place large bitmaps --sized a few words--in some slab pages) but in general does compete well with SLUBs space use.
The SLAB scheme of not touching the object during management is adopted. SLEB can efficiently free and allocate cache cold objects.
There are numerous SLAB schemes that are not supported. Those could be added if needed and if they really make a difference.
WARNING: This only ran successfully in a kvm instance so far.
--- include/linux/slub_def.h | 11 mm/slub.c | 912 +++++++++++++++++++++-------------------------- 2 files changed, 415 insertions(+), 508 deletions(-)
include/linux/slub_def.h +6 -5
@@ -34,13 +34,16 @@ enum stat_item {ORDER_FALLBACK ,/* Number of times fallback was necessary */ NR_SLUB_STAT_ITEMS }; +#define BOOT_QUEUE_SIZE 50 +#define BOOT_BATCH_SIZE 25 +struct kmem_cache_cpu { -void **freelist;/* Pointer to first free per cpu object */ -struct page *page;/* The slab from which we are allocating */ -int node;/* The node of the page (or -1 for debug) */ #ifdef CONFIG_SLUB_STATS unsigned stat[NR_SLUB_STAT_ITEMS ];#endif +int objects;/* Number of objects available */ +int node;/* The node of the page (or -1 for debug) */ +void *object[BOOT_QUEUE_SIZE ];/* List of objects */ }; struct kmem_cache_node {
@@ -72,9 +75,7 @@ struct kmem_cache {unsigned long flags;int size;/* The size of an object including meta data */ int objsize;/* The size of an object without meta data */ -int offset;/* Free pointer offset. */ struct kmem_cache_order_objects oo; -/* * Avoid an extra cache line for UP, SMP and for the node local to * struct kmem_cache.
mm/slub.c +409 -503
1,417 lines not on this page · raw message
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 7/10 SLEB: Resize cpu queue
In reply to Christoph LameterAllow resizing of cpu queue and batch sizes
--- include/linux/slub_def.h | 2 mm/slub.c | 116 ++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 111 insertions(+), 7 deletions(-)
mm/slub.c +109 -7
@@ -1542,10 +1542,40 @@ static void flush_all(struct kmem_cachestruct kmem_cache_cpu *alloc_kmem_cache_cpu (struct kmem_cache *s,int n) { -return __alloc_percpu (sizeof (struct kmem_cache_cpu ), +return __alloc_percpu ( +sizeof (struct kmem_cache_cpu ) +sizeof (void *) * (n -BOOT_QUEUE_SIZE ), __alignof__(struct kmem_cache_cpu )); } +static int is_kmalloc_cache (struct kmem_cache *s); + +static void resize_cpu_queue (struct kmem_cache *s,int queue) +{ + +if (is_kmalloc_cache (s)) { +if (queue <BOOT_QUEUE_SIZE ) { + s->queue = queue; +if (s->batch > queue) + s->batch = queue; + }else { +/* More than max. Go to max allowed */ + s->queue =BOOT_QUEUE_SIZE ; + s->batch =BOOT_BATCH_SIZE ; + } + }else { +struct kmem_cache_cpu *n =alloc_kmem_cache_cpu (s, queue); +struct kmem_cache_cpu *o = s->cpu_slab; + +/* Some serialization issues are remaining here since we cannot lock the slab */ +down_write (&slub_lock); +flush_all (s); + s->cpu_slab = n; + s->queue = queue; +up_write (&slub_lock); +free_percpu (o); + } +} +/* * Check if the objects in a per cpu structure fit numa * locality expectations.
@@ -1678,7 +1708,7 @@ redo: c->node = node; } -while (c->objects <BOOT_BATCH_SIZE ) { +while (c->objects < s->batch) {struct page *new;int d;
@@ -1706,7 +1736,7 @@ redo: }else stat (s,ALLOC_FROM_PARTIAL ); - d =min (BOOT_BATCH_SIZE - c->objects,available (new)); + d =min (s->batch - c->objects,available (new));retrieve_objects (s, new, c->object + c->objects, d); c->objects += d;
@@ -1806,9 +1836,9 @@ static void slab_free(struct kmem_cacheif (!(s->flags &SLAB_DEBUG_OBJECTS ))debug_check_no_obj_freed (object, s->objsize); -if (unlikely (c->objects >=BOOT_QUEUE_SIZE )) { +if (unlikely (c->objects >= s->queue)) { -int t =min (BOOT_BATCH_SIZE , c->objects); +int t =min (s->batch, c->objects);drain_objects (s, c->object, t);
@@ -2028,7 +2058,7 @@ static inline int alloc_kmem_cache_cpus( s->cpu_slab = kmalloc_percpu + (s - kmalloc_caches); else - s->cpu_slab = alloc_kmem_cache_cpu(s, BOOT_QUEUE_SIZE); + s->cpu_slab = alloc_kmem_cache_cpu(s, s->queue);if (!s->cpu_slab)return 0 ;
@@ -2261,6 +2291,26 @@ static int calculate_sizes(struct kmem_c } +/* Autotuning of the per cpu queueing */ +void initial_cpu_queue_setup (struct kmem_cache *s) +{ +if (s->size >PAGE_SIZE ) + s->queue =8 ; +else if (s->size >1024 ) + s->queue =24 ; +else if (s->size >256 ) + s->queue =54 ; +else + s->queue =120 ; + +if (is_kmalloc_cache (s) && s->queue >BOOT_QUEUE_SIZE ) { +/* static so cap it */ + s->queue =BOOT_QUEUE_SIZE ; + } + + s->batch = (s->queue +1 ) /2 ; +} + static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags, const char *name, size_t size, size_t align, unsigned long flags,
@@ -2296,6 +2346,7 @@ static int kmem_cache_open(struct kmem_c#ifdef CONFIG_NUMA s->remote_node_defrag_ratio =1000 ;#endif +initial_cpu_queue_setup (s);if (!init_kmem_cache_nodes (s, gfpflags & ~SLUB_DMA )) goto error;
@@ -3846,6 +3897,55 @@ static ssize_t min_partial_store(struct }SLAB_ATTR (min_partial); +static ssize_t cpu_queue_size_show (struct kmem_cache *s,char *buf) +{ +return sprintf (buf,"%u\n" , s->queue); +} + +static ssize_t cpu_queue_size_store (struct kmem_cache *s, +const char *buf,size_t length) +{ +unsigned long queue; +int err; + + err =strict_strtoul (buf,10 , &queue); +if (err) +return err; + +if (queue >10000 || queue <4 ) +return -EINVAL ; + +if (s->batch > queue) + s->batch = queue; + +resize_cpu_queue (s, queue); +return length; +} +SLAB_ATTR (cpu_queue_size); + +static ssize_t cpu_batch_size_show (struct kmem_cache *s,char *buf) +{ +return sprintf (buf,"%u\n" , s->batch); +} + +static ssize_t cpu_batch_size_store (struct kmem_cache *s, +const char *buf,size_t length) +{ +unsigned long batch; +int err; + + err =strict_strtoul (buf,10 , &batch); +if (err) +return err; + +if (batch < s->queue || batch <4 ) +return -EINVAL ; + + s->batch = batch; +return length; +} +SLAB_ATTR (cpu_batch_size); +static ssize_t ctor_show (struct kmem_cache *s,char *buf) {if (s->ctor) {
@@ -4195,6 +4295,8 @@ static struct attribute *slab_attrs[] = &objs_per_slab_attr.attr, &order_attr.attr, &min_partial_attr.attr, + &cpu_queue_size_attr.attr, + &cpu_batch_size_attr.attr, &objects_attr.attr, &objects_partial_attr.attr, &total_objects_attr.attr,
@@ -4552,7 +4654,7 @@ static int s_show(struct seq_file *m, voseq_printf (m,"%-17s %6lu %6lu %6u %4u %4d" , s->name, nr_inuse, nr_objs, s->size,oo_objects (s->oo), (1 <<oo_order (s->oo))); -seq_printf (m," : tunables %4u %4u %4u" ,0 ,0 ,0 ); +seq_printf (m," : tunables %4u %4u %4u" , s->queue, s->batch,0 );seq_printf (m," : slabdata %6lu %6lu %6lu" , nr_slabs, nr_slabs,0UL );seq_putc (m,'\n' );
include/linux/slub_def.h +2 -0
@@ -76,6 +76,8 @@ struct kmem_cache {int size;/* The size of an object including meta data */ int objsize;/* The size of an object without meta data */ struct kmem_cache_order_objects oo; +int queue;/* per cpu queue size */ +int batch;/* Batch size */ /* * Avoid an extra cache line for UP, SMP and for the node local to * struct kmem_cache.
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 8/10 SLED: Get rid of useless function
In reply to Christoph Lametercount_free() == available()
--- mm/slub.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
mm/slub.c +3 -8
@@ -1589,11 +1589,6 @@ static inline int node_match(struct kmemreturn 1 ; } -static int count_free (struct page *page) -{ -return available (page); -} -static unsigned long count_partial (struct kmem_cache_node *n,int (*get_count)(struct page *)) {
@@ -1642,7 +1637,7 @@ slab_out_of_memory(struct kmem_cache *s,if (!n)continue ; - nr_free =count_partial (n, count_free); + nr_free =count_partial (n, available); nr_slabs =node_nr_slabs (n); nr_objs =node_nr_objs (n);
@@ -3765,7 +3760,7 @@ static ssize_t show_slab_objects(struct x =atomic_long_read (&n->total_objects); else if (flags & SO_OBJECTS) x =atomic_long_read (&n->total_objects) - -count_partial (n, count_free); +count_partial (n, available); else x =atomic_long_read (&n->nr_slabs);
@@ -4646,7 +4641,7 @@ static int s_show(struct seq_file *m, vo nr_partials += n->nr_partial; nr_slabs +=atomic_long_read (&n->nr_slabs); nr_objs +=atomic_long_read (&n->total_objects); - nr_free +=count_partial (n, count_free); + nr_free +=count_partial (n, available); } nr_inuse = nr_objs - nr_free;
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 9/10 SLEB: Remove MAX_OBJS limitation
In reply to Christoph LameterThere is no need anymore for the inuse field. Extend the objects field to 32 bit allowing a practically unlimited number of objects.
--- include/linux/mm_types.h | 5 +---- mm/slub.c | 7 ------- 2 files changed, 1 insertion(+), 11 deletions(-)
include/linux/mm_types.h +1 -4
@@ -40,10 +40,7 @@ struct page {* to show when page is mapped * & limit reverse map searches. */ -struct {/* SLUB */ -u16 inuse; -u16 objects; - }; +u32 objects;/* SLEB */ }; union { struct {
mm/slub.c +0 -7
@@ -152,7 +152,6 @@ static inline int debug_on(struct kmem_c#define OO_SHIFT 16#define OO_MASK ((1 << OO_SHIFT) - 1) -#define MAX_OBJS_PER_PAGE 65535/* since page.objects is u16 */ /* Internal SLUB flags */ #define __OBJECT_POISON 0x80000000UL/* Poison object */
@@ -771,9 +770,6 @@ static int verify_slab(struct kmem_cache max_objects = ((void *)page->freelist - start) / s->size; } -if (max_objects >MAX_OBJS_PER_PAGE ) - max_objects =MAX_OBJS_PER_PAGE ; -if (page->objects != max_objects) {slab_err (s, page,"Wrong number of objects. Found %d but " "should be %d" , page->objects, max_objects);
@@ -1931,9 +1927,6 @@ static inline int slab_order(int size, iint rem;int min_order = slub_min_order; -if ((PAGE_SIZE << min_order) / size >MAX_OBJS_PER_PAGE ) -return get_order (size *MAX_OBJS_PER_PAGE ) -1 ; -for (order =max (min_order,fls (min_objects * size -1 ) -PAGE_SHIFT ); order <= max_order; order++) {
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC 10/10 SLEB: Add shared cache
In reply to Christoph LameterAdd support for a shared cache like SLAB
--- include/linux/slub_def.h | 3 +++ mm/slub.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)
include/linux/slub_def.h +3 -0
@@ -55,6 +55,9 @@ struct kmem_cache_node {atomic_long_t total_objects;struct list_head full;#endif +int objects; +spinlock_t shared_lock; +void *object[BOOT_QUEUE_SIZE ]; };/*
mm/slub.c +41 -0
59 lines not on this page · raw message
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>