linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2][RESEND] slab: avoid unnecessary touching of a partial slab
@ 2011-08-26 16:28 Zhao Jin
  2012-01-23 13:22 ` Pekka Enberg
  0 siblings, 1 reply; 3+ messages in thread
From: Zhao Jin @ 2011-08-26 16:28 UTC (permalink / raw)
  To: cl, penberg, mpm; +Cc: linux-kernel, Zhao Jin

In cache_alloc_refill(), after refilling from a partial slab, if the
slab remains partial, it would be deleted from and then added again to
the partial list. As the slab is the first element in the list before
deletion, such behavior has no effect. This patch avoids touching the
slab in this case.

Signed-off-by: Zhao Jin <cronozhj@gmail.com>
---
 mm/slab.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 82e0a0e..2d7a0f4 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3121,11 +3121,10 @@ retry:
 		check_slabp(cachep, slabp);
 
 		/* move slabp to correct slabp list: */
-		list_del(&slabp->list);
 		if (slabp->free == BUFCTL_END)
-			list_add(&slabp->list, &l3->slabs_full);
-		else
-			list_add(&slabp->list, &l3->slabs_partial);
+			list_move(entry, &l3->slabs_full);
+		else if (entry != l3->slabs_partial.next)
+			list_move(entry, &l3->slabs_partial);
 	}
 
 must_grow:
-- 
1.7.4.1


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

* Re: [PATCH 2/2][RESEND] slab: avoid unnecessary touching of a partial slab
  2011-08-26 16:28 [PATCH 2/2][RESEND] slab: avoid unnecessary touching of a partial slab Zhao Jin
@ 2012-01-23 13:22 ` Pekka Enberg
  2012-01-23 14:48   ` Christoph Lameter
  0 siblings, 1 reply; 3+ messages in thread
From: Pekka Enberg @ 2012-01-23 13:22 UTC (permalink / raw)
  To: Zhao Jin; +Cc: cl, mpm, rientjes, linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1135 bytes --]

[ Replying to an old patch that I seem to have missed. ]

On Sat, 27 Aug 2011, Zhao Jin wrote:
> In cache_alloc_refill(), after refilling from a partial slab, if the
> slab remains partial, it would be deleted from and then added again to
> the partial list. As the slab is the first element in the list before
> deletion, such behavior has no effect. This patch avoids touching the
> slab in this case.
>
> Signed-off-by: Zhao Jin <cronozhj@gmail.com>

Looks good to me, Christoph, David?

> ---
> mm/slab.c |    7 +++----
> 1 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/mm/slab.c b/mm/slab.c
> index 82e0a0e..2d7a0f4 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -3121,11 +3121,10 @@ retry:
> 		check_slabp(cachep, slabp);
>
> 		/* move slabp to correct slabp list: */
> -		list_del(&slabp->list);
> 		if (slabp->free == BUFCTL_END)
> -			list_add(&slabp->list, &l3->slabs_full);
> -		else
> -			list_add(&slabp->list, &l3->slabs_partial);
> +			list_move(entry, &l3->slabs_full);
> +		else if (entry != l3->slabs_partial.next)
> +			list_move(entry, &l3->slabs_partial);
> 	}
>
> must_grow:
> -- 
> 1.7.4.1
>
>

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

* Re: [PATCH 2/2][RESEND] slab: avoid unnecessary touching of a partial slab
  2012-01-23 13:22 ` Pekka Enberg
@ 2012-01-23 14:48   ` Christoph Lameter
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Lameter @ 2012-01-23 14:48 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Zhao Jin, mpm, rientjes, linux-kernel

On Mon, 23 Jan 2012, Pekka Enberg wrote:

> > diff --git a/mm/slab.c b/mm/slab.c
> > index 82e0a0e..2d7a0f4 100644
> > --- a/mm/slab.c
> > +++ b/mm/slab.c
> > @@ -3121,11 +3121,10 @@ retry:
> > 		check_slabp(cachep, slabp);
> >
> > 		/* move slabp to correct slabp list: */
> > -		list_del(&slabp->list);
> > 		if (slabp->free == BUFCTL_END)
> > -			list_add(&slabp->list, &l3->slabs_full);
> > -		else
> > -			list_add(&slabp->list, &l3->slabs_partial);
> > +			list_move(entry, &l3->slabs_full);
> > +		else if (entry != l3->slabs_partial.next)

Why is the check for entry necessary? We are holding a lock that
prevents modifications to the list after all.

Just a list_move when the partial slab is drained seems to be sufficient.

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

end of thread, other threads:[~2012-01-23 14:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-26 16:28 [PATCH 2/2][RESEND] slab: avoid unnecessary touching of a partial slab Zhao Jin
2012-01-23 13:22 ` Pekka Enberg
2012-01-23 14:48   ` Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).