All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] slab: resize the alien caches too
@ 2007-04-18  0:44 Siddha, Suresh B
  2007-04-18  0:48 ` Christoph Lameter
  2007-04-18  4:34 ` Eric Dumazet
  0 siblings, 2 replies; 4+ messages in thread
From: Siddha, Suresh B @ 2007-04-18  0:44 UTC (permalink / raw)
  To: clameter; +Cc: akpm, linux-kernel

Christoph,

While going through the slab code, I observed that alien caches are
not getting resized, when user changes the slab tunables. Appended patch
tries to fix this. Please review and let me know if I missed anything.

thanks,
suresh
---

Resize the alien caches too based on the slab tunables.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---

diff --git a/mm/slab.c b/mm/slab.c
index 4cbac24..e0dd9af 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3823,6 +3823,7 @@ static int alloc_kmemlist(struct kmem_cache *cachep)
 		l3 = cachep->nodelists[node];
 		if (l3) {
 			struct array_cache *shared = l3->shared;
+			struct array_cache **alien = l3->alien;
 
 			spin_lock_irq(&l3->list_lock);
 
@@ -3831,15 +3832,15 @@ static int alloc_kmemlist(struct kmem_cache *cachep)
 						shared->avail, node);
 
 			l3->shared = new_shared;
-			if (!l3->alien) {
-				l3->alien = new_alien;
-				new_alien = NULL;
-			}
+			l3->alien = new_alien;
 			l3->free_limit = (1 + nr_cpus_node(node)) *
 					cachep->batchcount + cachep->num;
 			spin_unlock_irq(&l3->list_lock);
 			kfree(shared);
-			free_alien_cache(new_alien);
+			if (alien) {
+				drain_alien_cache(cachep, alien);
+				free_alien_cache(alien);
+			}
 			continue;
 		}
 		l3 = kmalloc_node(sizeof(struct kmem_list3), GFP_KERNEL, node);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] slab: resize the alien caches too
  2007-04-18  0:44 [patch] slab: resize the alien caches too Siddha, Suresh B
@ 2007-04-18  0:48 ` Christoph Lameter
  2007-04-18  1:14   ` Siddha, Suresh B
  2007-04-18  4:34 ` Eric Dumazet
  1 sibling, 1 reply; 4+ messages in thread
From: Christoph Lameter @ 2007-04-18  0:48 UTC (permalink / raw)
  To: Siddha, Suresh B; +Cc: akpm, linux-kernel

On Tue, 17 Apr 2007, Siddha, Suresh B wrote:

> While going through the slab code, I observed that alien caches are
> not getting resized, when user changes the slab tunables. Appended patch
> tries to fix this. Please review and let me know if I missed anything.

Let it be. We have not resized the alien caches ever and doing so may 
cause serious memory usage. Size is hardcoded to 12 anyways.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] slab: resize the alien caches too
  2007-04-18  0:48 ` Christoph Lameter
@ 2007-04-18  1:14   ` Siddha, Suresh B
  0 siblings, 0 replies; 4+ messages in thread
From: Siddha, Suresh B @ 2007-04-18  1:14 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: Siddha, Suresh B, akpm, linux-kernel

On Tue, Apr 17, 2007 at 05:48:30PM -0700, Christoph Lameter wrote:
> On Tue, 17 Apr 2007, Siddha, Suresh B wrote:
> 
> > While going through the slab code, I observed that alien caches are
> > not getting resized, when user changes the slab tunables. Appended patch
> > tries to fix this. Please review and let me know if I missed anything.
> 
> Let it be. We have not resized the alien caches ever and doing so may 
> cause serious memory usage. Size is hardcoded to 12 anyways.

hmm.. I see.

Let me do some experiments and getback to you(with what I am looking
exactly).

thanks,
suresh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] slab: resize the alien caches too
  2007-04-18  0:44 [patch] slab: resize the alien caches too Siddha, Suresh B
  2007-04-18  0:48 ` Christoph Lameter
@ 2007-04-18  4:34 ` Eric Dumazet
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2007-04-18  4:34 UTC (permalink / raw)
  To: Siddha, Suresh B; +Cc: clameter, akpm, linux-kernel

Siddha, Suresh B a écrit :
> Christoph,
> 
> While going through the slab code, I observed that alien caches are
> not getting resized, when user changes the slab tunables. Appended patch
> tries to fix this. Please review and let me know if I missed anything.
> 
> thanks,
> suresh
> ---
> 
> Resize the alien caches too based on the slab tunables.
> 
> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
> ---
> 
> diff --git a/mm/slab.c b/mm/slab.c
> index 4cbac24..e0dd9af 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -3823,6 +3823,7 @@ static int alloc_kmemlist(struct kmem_cache *cachep)
>  		l3 = cachep->nodelists[node];
>  		if (l3) {
>  			struct array_cache *shared = l3->shared;
> +			struct array_cache **alien = l3->alien;
>  
>  			spin_lock_irq(&l3->list_lock);
>  

Christoph already rejected the patch, but I have one further comment : 
l3->alien should be fetched after spin_lock_irq() of course.

It's true that the :
if (limit > 1) limit = 12;
from alloc_alien_cache() is quite disturbing and could be cleaned up.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-18  4:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-18  0:44 [patch] slab: resize the alien caches too Siddha, Suresh B
2007-04-18  0:48 ` Christoph Lameter
2007-04-18  1:14   ` Siddha, Suresh B
2007-04-18  4:34 ` Eric Dumazet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.