slqb: irq section fix
PATCH 1/5 slqb: irq section fix
slqb: irq section fix
flush_free_list can be called with interrupts enabled, from kmem_cache_destroy. Fix this.
---
mm/slqb.c +6 -3
@@ -1087,7 +1087,6 @@ static void slab_free_to_remote(struct k*/ static void flush_free_list (struct kmem_cache *s,struct kmem_cache_list *l) { -struct kmem_cache_cpu *c;void **head;int nr;
@@ -1100,8 +1099,6 @@ static void flush_free_list(struct kmem_slqb_stat_inc (l,FLUSH_FREE_LIST );slqb_stat_add (l,FLUSH_FREE_LIST_OBJECTS , nr); - c =get_cpu_slab (s,smp_processor_id ()); - l->freelist.nr -= nr; head = l->freelist.head;
@@ -1116,6 +1113,10 @@ static void flush_free_list(struct kmem_#ifdef CONFIG_SMP if (page->list != l) { +struct kmem_cache_cpu *c; + + c =get_cpu_slab (s,smp_processor_id ()); +slab_free_to_remote (s, page, object, c);slqb_stat_inc (l,FLUSH_FREE_LIST_REMOTE ); }else
@@ -2251,6 +2252,7 @@ void kmem_cache_destroy(struct kmem_cachdown_write (&slqb_lock);list_del (&s->list); +local_irq_disable ();#ifdef CONFIG_SMP for_each_online_cpu (cpu) {struct kmem_cache_cpu *c =get_cpu_slab (s, cpu);
@@ -2297,6 +2299,7 @@ void kmem_cache_destroy(struct kmem_cachfree_kmem_cache_nodes (s);#endif +local_irq_enable ();sysfs_slab_remove (s);up_write (&slqb_lock);
--
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>
PATCH 2/5 slqb: fix compilation warning
slqb: fix compilation warning
gather_stats is not used if CONFIG_SLQB_SYSFS is not selected. Make it conditional and avoid the warning.
---
mm/slqb.c +2 -0
@@ -3121,6 +3121,7 @@ static void gather_stats_locked(struct k stats->nr_objects = stats->nr_slabs * s->objects; } +#ifdef CONFIG_SLQB_SYSFS static void gather_stats (struct kmem_cache *s,struct stats_gather *stats) {down_read (&slqb_lock);/* hold off hotplug */
@@ -3128,6 +3129,7 @@ static void gather_stats(struct kmem_cacup_read (&slqb_lock); }#endif +#endif /* * The /proc/slabinfo ABI
--
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>
PATCH 3/5 slqb: cap remote free list size
In reply to Nick Pigginslqb: cap remote free list size
SLQB has a design flaw noticed by Yanmin Zhang when doing network packet stress testing.
My intention with lockless slab lists had been to try to balance producer/consumer type activity on the object queues just at allocation-time with the producer and free-time with the consumer. But that breaks down if you have a huge number of objects in-flight and then free them after activity is reduced at the producer-side.
Basically just objects being allocated on CPU0 are then freed by CPU1 but then rely on activity from CPU0 (or periodic trimming) to free them back to the page allocator. If there is infrequent activity on CPU0, then it can take a long time for the periodic trimming to free up unused objects.
Fix this by adding a lock to the page list queues and allowing CPU1 to do the freeing work synchronously if queues get too large. It allows "nice" producer/consumer type patterns to still fit within the fast object queues, without the possibility to build up a lot of objects... The spinlock should not be a big problem for nice workloads, as it is at least an order of magnitude less frequent than an object allocation/free operation.
include/linux/slqb_def.h +3 -0
@@ -77,6 +77,9 @@ struct kmem_cache_list {/* Total number of slabs allocated */ unsigned long nr_slabs; +/* Protects nr_partial, nr_slabs, and partial */ +spinlock_t page_lock; +#ifdef CONFIG_SMP /* * In the case of per-cpu lists, remote_free is for objects freed by
mm/slqb.c +69 -3
155 lines not on this page · raw message
--
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>
PATCH 4/5 slqb: config slab size
In reply to Nick Pigginslqb: config slab size
Yanmin Zhang had reported performance increases in a routing stress test with SLUB using gigantic slab sizes. The theory is either increased TLB efficiency or reduced page allocator costs. Anyway it is trivial and basically no overhead to add similar parameters to SLQB to experiment with.
---
mm/slqb.c +41 -2
@@ -56,6 +56,17 @@ static inline void struct_slqb_page_wron#define PG_SLQB_BIT (1 << PG_slab) +/* +* slqb_min_order: minimum allocation order for slabs +*/ +static int slqb_min_order =0 ; + +/* +* slqb_min_objects: minimum number of objects per slab. Increasing this +* will increase the allocation order for slabs with larger objects +*/ +static int slqb_min_objects =1 ; +#ifdef CONFIG_NUMA static inline int slab_numa (struct kmem_cache *s) {
@@ -856,9 +867,25 @@ check_slabs: out:return 1 ; } -__setup ("slqb_debug" , setup_slqb_debug); +static int __init setup_slqb_min_order (char *str) +{ +get_option (&str, &slqb_min_order); + +return 1 ; +} +__setup ("slqb_min_order=" , setup_slqb_min_order); + +static int __init setup_slqb_min_objects (char *str) +{ +get_option (&str, &slqb_min_objects); + +return 1 ; +} + +__setup ("slqb_min_objects=" , setup_slqb_min_objects); +static unsigned long kmem_cache_flags (unsigned long objsize,unsigned long flags,const char *name,void (*ctor)(void *))
@@ -1758,6 +1785,8 @@ static int slab_order(int size, int max_ order =0 ; else order =fls (size -1 ) -PAGE_SHIFT ; +if (order < slqb_min_order) + order = slqb_min_order;while (order <= max_order) {unsigned long slab_size =PAGE_SIZE << order;
@@ -1766,13 +1795,23 @@ static int slab_order(int size, int max_ objects = slab_size / size;if (!objects) -continue ; + goto next; + +if (order <MAX_ORDER && objects < slqb_min_objects) { +/* +* if we don't have enough objects for min_objects, +* then try the next size up. Unless we have reached +* our maximum possible page size. +*/ + goto next; + } waste = slab_size - (objects * size);if (waste * frac <= slab_size)break ; +next: order++; }
--
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>
PATCH 5/5 mm: prompt slqb default for oldconfig
In reply to Nick PigginHi Pekka,
Well there have been reasonably significant changes both for SLQB and SLUB that I thought it is better to wait one more round before merging SLQB. Also, SLQB may not have been getting as much testing as it could have in -next, due to oldconfig choosing existing config as the default.
Thanks,
Nick
--
Change Kconfig names for slab allocator choices to prod SLQB into being the default. Hopefully increasing testing base.
---
init/Kconfig +19 -4
@@ -975,18 +975,23 @@ config COMPAT_BRK choice prompt "Choose SLAB allocator" - default SLQB + default SLQB_ALLOCATOR help This option allows to select a slab allocator. -config SLAB +config SLAB_ALLOCATOR bool "SLAB" help The regular slab allocator that is established and known to work well in all environments. It organizes cache hot objects in per cpu and per node queues. -config SLUB +config SLAB + bool + default y + depends on SLAB_ALLOCATOR + +config SLUB_ALLOCATOR bool "SLUB (Unqueued Allocator)" help SLUB is a slab allocator that minimizes cache line usage
@@ -996,11 +1001,21 @@ config SLUB and has enhanced diagnostics. SLUB is the default choice for a slab allocator. -config SLQB +config SLUB + bool + default y + depends on SLUB_ALLOCATOR + +config SLQB_ALLOCATOR bool "SLQB (Queued allocator)" help SLQB is a proposed new slab allocator. +config SLQB + bool + default y + depends on SLQB_ALLOCATOR + config SLOB depends on EMBEDDED bool "SLOB (Simple Allocator)"
--
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>
Re: [patch 5/5] mm: prompt slqb default for oldconfig
Hi Nick,
Quoted 7 lines · Nick Piggin
Hi Pekka,
Well there have been reasonably significant changes both for SLQB and SLUB that I thought it is better to wait one more round before merging SLQB. Also, SLQB may not have been getting as much testing as it could have in -next, due to oldconfig choosing existing config as the default.
Quoted 8 lines
Thanks,
Nick
--Change
Kconfignames for slab allocator choices to prod SLQB into being the default. Hopefully increasing testing base.Signed-off-by Nick Piggin <[email protected]>
I went ahead and applied this too. IIRC, Ingo had some ideas how this should be handled so lets CC him as well.
Pekka
Quoted 45 lines
---
Index: linux-2.6/init/Kconfig
===================================================================init/Kconfig +14
-4@@ -975,18 +975,23 @@ config COMPAT_BRK choice prompt "Choose SLAB allocator" - default SLQB + default SLQB_ALLOCATOR help This option allows to select a slab allocator. -config SLAB +config SLAB_ALLOCATOR bool "SLAB" help The regular slab allocator that is established and known to work well in all environments. It organizes cache hot objects in per cpu and per node queues. -config SLUB +config SLAB + bool + default y + depends on SLAB_ALLOCATOR + +config SLUB_ALLOCATOR bool "SLUB (Unqueued Allocator)" help SLUB is a slab allocator that minimizes cache line usage@@ -996,11 +1001,21 @@ config SLUB and has enhanced diagnostics. SLUB is the default choice for a slab allocator. -config SLQB +config SLUB + bool + default y + depends on SLUB_ALLOCATOR + +config SLQB_ALLOCATOR bool "SLQB (Queued allocator)" help
init/Kconfig config SLUB · line 1021
Quoted 10 lines
init/Kconfig +5
-0SLQB is a proposed new slab allocator. +config SLQB + bool + default y + depends on SLQB_ALLOCATOR + config SLOB depends on EMBEDDED bool "SLOB (Simple Allocator)"
--
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>
Re: [patch 5/5] mm: prompt slqb default for oldconfig
Quoted 14 lines · Pekka Enberg
Hi Nick,
Quoted 11 lines · Nick Piggin
Hi Pekka,
Well there have been reasonably significant changes both for SLQB and SLUB that I thought it is better to wait one more round before merging SLQB. Also, SLQB may not have been getting as much testing as it could have in -next, due to oldconfig choosing existing config as the default.
Thanks,
Nick
--
Quoted 7 lines
Quoted 4 lines
Change
Kconfignames for slab allocator choices to prod SLQB into being the default. Hopefully increasing testing base.Signed-off-by Nick Piggin <[email protected]>I went ahead and applied this too. IIRC, Ingo had some ideas how this should be handled so lets CC him as well.
I forgot it all already :)
Btw., i'm wondering, why didnt this make it into .30?
Ingo
--
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>
Re: [patch 5/5] mm: prompt slqb default for oldconfig
Quoted 20 lines · Ingo Molnar
Quoted 17 lines · Pekka Enberg
Hi Nick,
Quoted 14 lines · Nick Piggin
Hi Pekka,
Well there have been reasonably significant changes both for SLQB and SLUB that I thought it is better to wait one more round before merging SLQB. Also, SLQB may not have been getting as much testing as it could have in -next, due to oldconfig choosing existing config as the default.
Thanks,
Nick
--Change
Kconfignames for slab allocator choices to prod SLQB into being the default. Hopefully increasing testing base.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Nick Piggin <[email protected]>I went ahead and applied this too. IIRC, Ingo had some ideas how this should be handled so lets CC him as well.
I forgot it all already :)
I think I roughly followed consensus. Basically just rename the choices so oldconfig will default to Kconfig specified rather than the existing .config choice. We can just revert this little shim eventually.
Quoted 1 line
Btw., i'm wondering, why didnt this make it into .30?
Well, there was a flurry of activity on SLUB, and also one relatively significant change to SLQB, so in the interest of getting a more uptodate comparison, I think it better to wait one more round.
--
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>
Quoted 6 lines · Nick Piggin
slqb: irq section fix
flush_free_listcan be called with interrupts enabled, fromkmem_cache_destroy. Fix this.Signed-off-by Nick Piggin <[email protected]>
The series has been applied! Thanks.
Pekka
--
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>