* [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0
@ 2013-06-19 6:33 Joonsoo Kim
2013-06-19 8:00 ` Wanpeng Li
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Joonsoo Kim @ 2013-06-19 6:33 UTC (permalink / raw)
To: Pekka Enberg
Cc: Christoph Lameter, Matt Mackall, linux-mm, linux-kernel,
Joonsoo Kim
In free path, we don't check number of cpu_partial, so one slab can
be linked in cpu partial list even if cpu_partial is 0. To prevent this,
we should check number of cpu_partial in put_cpu_partial().
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
diff --git a/mm/slub.c b/mm/slub.c
index 57707f0..7033b4f 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1955,6 +1955,9 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
int pages;
int pobjects;
+ if (!s->cpu_partial)
+ return;
+
do {
pages = 0;
pobjects = 0;
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0
2013-06-19 6:33 [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0 Joonsoo Kim
2013-06-19 8:00 ` Wanpeng Li
@ 2013-06-19 8:00 ` Wanpeng Li
[not found] ` <51c1652d.246e320a.4057.ffffed4fSMTPIN_ADDED_BROKEN@mx.google.com>
` (2 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Wanpeng Li @ 2013-06-19 8:00 UTC (permalink / raw)
To: Joonsoo Kim
Cc: Pekka Enberg, Christoph Lameter, Matt Mackall, linux-mm,
linux-kernel
On Wed, Jun 19, 2013 at 03:33:55PM +0900, Joonsoo Kim wrote:
>In free path, we don't check number of cpu_partial, so one slab can
>be linked in cpu partial list even if cpu_partial is 0. To prevent this,
>we should check number of cpu_partial in put_cpu_partial().
>
How about skip get_partial entirely? put_cpu_partial is called
in two paths, one is during refill cpu partial lists in alloc
slow path, the other is in free slow path. And cpu_partial is 0
just in debug mode.
- alloc slow path, there is unnecessary to call get_partial
since cpu partial lists won't be used in debug mode.
- free slow patch, new.inuse won't be true in debug mode
which lead to put_cpu_partial won't be called.
Regards,
Wanpeng Li
>Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>
>diff --git a/mm/slub.c b/mm/slub.c
>index 57707f0..7033b4f 100644
>--- a/mm/slub.c
>+++ b/mm/slub.c
>@@ -1955,6 +1955,9 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
> int pages;
> int pobjects;
>
>+ if (!s->cpu_partial)
>+ return;
>+
> do {
> pages = 0;
> pobjects = 0;
>--
>1.7.9.5
>
>--
>To unsubscribe, send a message with 'unsubscribe linux-mm' in
>the body to majordomo@kvack.org. For more info on Linux MM,
>see: http://www.linux-mm.org/ .
>Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0
2013-06-19 6:33 [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0 Joonsoo Kim
@ 2013-06-19 8:00 ` Wanpeng Li
2013-06-19 8:00 ` Wanpeng Li
` (3 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Wanpeng Li @ 2013-06-19 8:00 UTC (permalink / raw)
To: Joonsoo Kim
Cc: Pekka Enberg, Christoph Lameter, Matt Mackall, linux-mm,
linux-kernel
On Wed, Jun 19, 2013 at 03:33:55PM +0900, Joonsoo Kim wrote:
>In free path, we don't check number of cpu_partial, so one slab can
>be linked in cpu partial list even if cpu_partial is 0. To prevent this,
>we should check number of cpu_partial in put_cpu_partial().
>
How about skip get_partial entirely? put_cpu_partial is called
in two paths, one is during refill cpu partial lists in alloc
slow path, the other is in free slow path. And cpu_partial is 0
just in debug mode.
- alloc slow path, there is unnecessary to call get_partial
since cpu partial lists won't be used in debug mode.
- free slow patch, new.inuse won't be true in debug mode
which lead to put_cpu_partial won't be called.
Regards,
Wanpeng Li
>Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>
>diff --git a/mm/slub.c b/mm/slub.c
>index 57707f0..7033b4f 100644
>--- a/mm/slub.c
>+++ b/mm/slub.c
>@@ -1955,6 +1955,9 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
> int pages;
> int pobjects;
>
>+ if (!s->cpu_partial)
>+ return;
>+
> do {
> pages = 0;
> pobjects = 0;
>--
>1.7.9.5
>
>--
>To unsubscribe, send a message with 'unsubscribe linux-mm' in
>the body to majordomo@kvack.org. For more info on Linux MM,
>see: http://www.linux-mm.org/ .
>Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0
[not found] ` <51c1652d.246e320a.4057.ffffed4fSMTPIN_ADDED_BROKEN@mx.google.com>
@ 2013-06-19 8:52 ` Joonsoo Kim
2013-06-20 0:26 ` Wanpeng Li
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Joonsoo Kim @ 2013-06-19 8:52 UTC (permalink / raw)
To: Wanpeng Li
Cc: Pekka Enberg, Christoph Lameter, Matt Mackall, linux-mm,
linux-kernel
On Wed, Jun 19, 2013 at 04:00:32PM +0800, Wanpeng Li wrote:
> On Wed, Jun 19, 2013 at 03:33:55PM +0900, Joonsoo Kim wrote:
> >In free path, we don't check number of cpu_partial, so one slab can
> >be linked in cpu partial list even if cpu_partial is 0. To prevent this,
> >we should check number of cpu_partial in put_cpu_partial().
> >
>
> How about skip get_partial entirely? put_cpu_partial is called
> in two paths, one is during refill cpu partial lists in alloc
> slow path, the other is in free slow path. And cpu_partial is 0
> just in debug mode.
>
> - alloc slow path, there is unnecessary to call get_partial
> since cpu partial lists won't be used in debug mode.
> - free slow patch, new.inuse won't be true in debug mode
> which lead to put_cpu_partial won't be called.
>
In debug mode, put_cpu_partial() can't be called already on both path.
But, if we assign 0 to cpu_partial via sysfs, put_cpu_partial() will be called
on free slow path. On alloc slow path, it can't be called, because following
test in get_partial_node() is always failed.
available > s->cpu_partial / 2
Thanks.
> Regards,
> Wanpeng Li
>
> >Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> >
> >diff --git a/mm/slub.c b/mm/slub.c
> >index 57707f0..7033b4f 100644
> >--- a/mm/slub.c
> >+++ b/mm/slub.c
> >@@ -1955,6 +1955,9 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
> > int pages;
> > int pobjects;
> >
> >+ if (!s->cpu_partial)
> >+ return;
> >+
> > do {
> > pages = 0;
> > pobjects = 0;
> >--
> >1.7.9.5
> >
> >--
> >To unsubscribe, send a message with 'unsubscribe linux-mm' in
> >the body to majordomo@kvack.org. For more info on Linux MM,
> >see: http://www.linux-mm.org/ .
> >Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0
2013-06-19 6:33 [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0 Joonsoo Kim
` (2 preceding siblings ...)
[not found] ` <51c1652d.246e320a.4057.ffffed4fSMTPIN_ADDED_BROKEN@mx.google.com>
@ 2013-06-19 14:25 ` Christoph Lameter
2013-07-07 15:47 ` Pekka Enberg
4 siblings, 0 replies; 11+ messages in thread
From: Christoph Lameter @ 2013-06-19 14:25 UTC (permalink / raw)
To: Joonsoo Kim; +Cc: Pekka Enberg, Matt Mackall, linux-mm, linux-kernel
On Wed, 19 Jun 2013, Joonsoo Kim wrote:
> In free path, we don't check number of cpu_partial, so one slab can
> be linked in cpu partial list even if cpu_partial is 0. To prevent this,
> we should check number of cpu_partial in put_cpu_partial().
Acked-by: Christoph Lameeter <cl@linux.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0
2013-06-19 8:52 ` Joonsoo Kim
@ 2013-06-20 0:26 ` Wanpeng Li
2013-06-20 0:26 ` Wanpeng Li
[not found] ` <51c24c29.425c320a.433e.ffff9d8fSMTPIN_ADDED_BROKEN@mx.google.com>
2 siblings, 0 replies; 11+ messages in thread
From: Wanpeng Li @ 2013-06-20 0:26 UTC (permalink / raw)
To: Joonsoo Kim
Cc: Pekka Enberg, Christoph Lameter, Matt Mackall, linux-mm,
linux-kernel
On Wed, Jun 19, 2013 at 05:52:50PM +0900, Joonsoo Kim wrote:
>On Wed, Jun 19, 2013 at 04:00:32PM +0800, Wanpeng Li wrote:
>> On Wed, Jun 19, 2013 at 03:33:55PM +0900, Joonsoo Kim wrote:
>> >In free path, we don't check number of cpu_partial, so one slab can
>> >be linked in cpu partial list even if cpu_partial is 0. To prevent this,
>> >we should check number of cpu_partial in put_cpu_partial().
>> >
>>
>> How about skip get_partial entirely? put_cpu_partial is called
>> in two paths, one is during refill cpu partial lists in alloc
>> slow path, the other is in free slow path. And cpu_partial is 0
>> just in debug mode.
>>
>> - alloc slow path, there is unnecessary to call get_partial
>> since cpu partial lists won't be used in debug mode.
>> - free slow patch, new.inuse won't be true in debug mode
>> which lead to put_cpu_partial won't be called.
>>
>
>In debug mode, put_cpu_partial() can't be called already on both path.
>But, if we assign 0 to cpu_partial via sysfs, put_cpu_partial() will be called
>on free slow path. On alloc slow path, it can't be called, because following
>test in get_partial_node() is always failed.
>
>available > s->cpu_partial / 2
Is it always true? We can freeze slab from partial list, and
s->cpu_partial is 0.
Regards,
Wanpeng Li
>
>Thanks.
>
>> Regards,
>> Wanpeng Li
>>
>> >Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>> >
>> >diff --git a/mm/slub.c b/mm/slub.c
>> >index 57707f0..7033b4f 100644
>> >--- a/mm/slub.c
>> >+++ b/mm/slub.c
>> >@@ -1955,6 +1955,9 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
>> > int pages;
>> > int pobjects;
>> >
>> >+ if (!s->cpu_partial)
>> >+ return;
>> >+
>> > do {
>> > pages = 0;
>> > pobjects = 0;
>> >--
>> >1.7.9.5
>> >
>> >--
>> >To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> >the body to majordomo@kvack.org. For more info on Linux MM,
>> >see: http://www.linux-mm.org/ .
>> >Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>>
>> --
>> To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> the body to majordomo@kvack.org. For more info on Linux MM,
>> see: http://www.linux-mm.org/ .
>> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0
2013-06-19 8:52 ` Joonsoo Kim
2013-06-20 0:26 ` Wanpeng Li
@ 2013-06-20 0:26 ` Wanpeng Li
[not found] ` <51c24c29.425c320a.433e.ffff9d8fSMTPIN_ADDED_BROKEN@mx.google.com>
2 siblings, 0 replies; 11+ messages in thread
From: Wanpeng Li @ 2013-06-20 0:26 UTC (permalink / raw)
To: Joonsoo Kim
Cc: Pekka Enberg, Christoph Lameter, Matt Mackall, linux-mm,
linux-kernel
On Wed, Jun 19, 2013 at 05:52:50PM +0900, Joonsoo Kim wrote:
>On Wed, Jun 19, 2013 at 04:00:32PM +0800, Wanpeng Li wrote:
>> On Wed, Jun 19, 2013 at 03:33:55PM +0900, Joonsoo Kim wrote:
>> >In free path, we don't check number of cpu_partial, so one slab can
>> >be linked in cpu partial list even if cpu_partial is 0. To prevent this,
>> >we should check number of cpu_partial in put_cpu_partial().
>> >
>>
>> How about skip get_partial entirely? put_cpu_partial is called
>> in two paths, one is during refill cpu partial lists in alloc
>> slow path, the other is in free slow path. And cpu_partial is 0
>> just in debug mode.
>>
>> - alloc slow path, there is unnecessary to call get_partial
>> since cpu partial lists won't be used in debug mode.
>> - free slow patch, new.inuse won't be true in debug mode
>> which lead to put_cpu_partial won't be called.
>>
>
>In debug mode, put_cpu_partial() can't be called already on both path.
>But, if we assign 0 to cpu_partial via sysfs, put_cpu_partial() will be called
>on free slow path. On alloc slow path, it can't be called, because following
>test in get_partial_node() is always failed.
>
>available > s->cpu_partial / 2
Is it always true? We can freeze slab from partial list, and
s->cpu_partial is 0.
Regards,
Wanpeng Li
>
>Thanks.
>
>> Regards,
>> Wanpeng Li
>>
>> >Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>> >
>> >diff --git a/mm/slub.c b/mm/slub.c
>> >index 57707f0..7033b4f 100644
>> >--- a/mm/slub.c
>> >+++ b/mm/slub.c
>> >@@ -1955,6 +1955,9 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
>> > int pages;
>> > int pobjects;
>> >
>> >+ if (!s->cpu_partial)
>> >+ return;
>> >+
>> > do {
>> > pages = 0;
>> > pobjects = 0;
>> >--
>> >1.7.9.5
>> >
>> >--
>> >To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> >the body to majordomo@kvack.org. For more info on Linux MM,
>> >see: http://www.linux-mm.org/ .
>> >Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>>
>> --
>> To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> the body to majordomo@kvack.org. For more info on Linux MM,
>> see: http://www.linux-mm.org/ .
>> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0
[not found] ` <51c24c29.425c320a.433e.ffff9d8fSMTPIN_ADDED_BROKEN@mx.google.com>
@ 2013-06-20 1:44 ` Joonsoo Kim
2013-06-20 2:32 ` Wanpeng Li
2013-06-20 2:32 ` Wanpeng Li
0 siblings, 2 replies; 11+ messages in thread
From: Joonsoo Kim @ 2013-06-20 1:44 UTC (permalink / raw)
To: Wanpeng Li
Cc: Pekka Enberg, Christoph Lameter, Matt Mackall, linux-mm,
linux-kernel
On Thu, Jun 20, 2013 at 08:26:03AM +0800, Wanpeng Li wrote:
> On Wed, Jun 19, 2013 at 05:52:50PM +0900, Joonsoo Kim wrote:
> >On Wed, Jun 19, 2013 at 04:00:32PM +0800, Wanpeng Li wrote:
> >> On Wed, Jun 19, 2013 at 03:33:55PM +0900, Joonsoo Kim wrote:
> >> >In free path, we don't check number of cpu_partial, so one slab can
> >> >be linked in cpu partial list even if cpu_partial is 0. To prevent this,
> >> >we should check number of cpu_partial in put_cpu_partial().
> >> >
> >>
> >> How about skip get_partial entirely? put_cpu_partial is called
> >> in two paths, one is during refill cpu partial lists in alloc
> >> slow path, the other is in free slow path. And cpu_partial is 0
> >> just in debug mode.
> >>
> >> - alloc slow path, there is unnecessary to call get_partial
> >> since cpu partial lists won't be used in debug mode.
> >> - free slow patch, new.inuse won't be true in debug mode
> >> which lead to put_cpu_partial won't be called.
> >>
> >
> >In debug mode, put_cpu_partial() can't be called already on both path.
> >But, if we assign 0 to cpu_partial via sysfs, put_cpu_partial() will be called
> >on free slow path. On alloc slow path, it can't be called, because following
> >test in get_partial_node() is always failed.
> >
> >available > s->cpu_partial / 2
>
> Is it always true? We can freeze slab from partial list, and
> s->cpu_partial is 0.
Do you mean node partial list?
At first, acquire_slab() is called for a cpu slab(not cpu partial list)
in get_partial_node(), and then, check above test. In this time, available
is always higher than 0, so, if we assign 0 to s->cpu_partial, we break
the loop and we don't try to get a slab for cpu partial list.
Thanks.
>
> Regards,
> Wanpeng Li
>
> >
> >Thanks.
> >
> >> Regards,
> >> Wanpeng Li
> >>
> >> >Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> >> >
> >> >diff --git a/mm/slub.c b/mm/slub.c
> >> >index 57707f0..7033b4f 100644
> >> >--- a/mm/slub.c
> >> >+++ b/mm/slub.c
> >> >@@ -1955,6 +1955,9 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
> >> > int pages;
> >> > int pobjects;
> >> >
> >> >+ if (!s->cpu_partial)
> >> >+ return;
> >> >+
> >> > do {
> >> > pages = 0;
> >> > pobjects = 0;
> >> >--
> >> >1.7.9.5
> >> >
> >> >--
> >> >To unsubscribe, send a message with 'unsubscribe linux-mm' in
> >> >the body to majordomo@kvack.org. For more info on Linux MM,
> >> >see: http://www.linux-mm.org/ .
> >> >Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> >>
> >> --
> >> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> >> the body to majordomo@kvack.org. For more info on Linux MM,
> >> see: http://www.linux-mm.org/ .
> >> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0
2013-06-20 1:44 ` Joonsoo Kim
@ 2013-06-20 2:32 ` Wanpeng Li
2013-06-20 2:32 ` Wanpeng Li
1 sibling, 0 replies; 11+ messages in thread
From: Wanpeng Li @ 2013-06-20 2:32 UTC (permalink / raw)
To: Joonsoo Kim
Cc: Pekka Enberg, Christoph Lameter, Matt Mackall, linux-mm,
linux-kernel
On Thu, Jun 20, 2013 at 10:44:40AM +0900, Joonsoo Kim wrote:
>On Thu, Jun 20, 2013 at 08:26:03AM +0800, Wanpeng Li wrote:
>> On Wed, Jun 19, 2013 at 05:52:50PM +0900, Joonsoo Kim wrote:
>> >On Wed, Jun 19, 2013 at 04:00:32PM +0800, Wanpeng Li wrote:
>> >> On Wed, Jun 19, 2013 at 03:33:55PM +0900, Joonsoo Kim wrote:
>> >> >In free path, we don't check number of cpu_partial, so one slab can
>> >> >be linked in cpu partial list even if cpu_partial is 0. To prevent this,
>> >> >we should check number of cpu_partial in put_cpu_partial().
>> >> >
>> >>
>> >> How about skip get_partial entirely? put_cpu_partial is called
>> >> in two paths, one is during refill cpu partial lists in alloc
>> >> slow path, the other is in free slow path. And cpu_partial is 0
>> >> just in debug mode.
>> >>
>> >> - alloc slow path, there is unnecessary to call get_partial
>> >> since cpu partial lists won't be used in debug mode.
>> >> - free slow patch, new.inuse won't be true in debug mode
>> >> which lead to put_cpu_partial won't be called.
>> >>
>> >
>> >In debug mode, put_cpu_partial() can't be called already on both path.
>> >But, if we assign 0 to cpu_partial via sysfs, put_cpu_partial() will be called
>> >on free slow path. On alloc slow path, it can't be called, because following
>> >test in get_partial_node() is always failed.
>> >
>> >available > s->cpu_partial / 2
>>
>> Is it always true? We can freeze slab from partial list, and
>> s->cpu_partial is 0.
>
>Do you mean node partial list?
>
Yup.
>At first, acquire_slab() is called for a cpu slab(not cpu partial list)
>in get_partial_node(), and then, check above test. In this time, available
>is always higher than 0, so, if we assign 0 to s->cpu_partial, we break
>the loop and we don't try to get a slab for cpu partial list.
>
Agreed.
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
>Thanks.
>
>>
>> Regards,
>> Wanpeng Li
>>
>> >
>> >Thanks.
>> >
>> >> Regards,
>> >> Wanpeng Li
>> >>
>> >> >Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>> >> >
>> >> >diff --git a/mm/slub.c b/mm/slub.c
>> >> >index 57707f0..7033b4f 100644
>> >> >--- a/mm/slub.c
>> >> >+++ b/mm/slub.c
>> >> >@@ -1955,6 +1955,9 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
>> >> > int pages;
>> >> > int pobjects;
>> >> >
>> >> >+ if (!s->cpu_partial)
>> >> >+ return;
>> >> >+
>> >> > do {
>> >> > pages = 0;
>> >> > pobjects = 0;
>> >> >--
>> >> >1.7.9.5
>> >> >
>> >> >--
>> >> >To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> >> >the body to majordomo@kvack.org. For more info on Linux MM,
>> >> >see: http://www.linux-mm.org/ .
>> >> >Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>> >>
>> >> --
>> >> To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> >> the body to majordomo@kvack.org. For more info on Linux MM,
>> >> see: http://www.linux-mm.org/ .
>> >> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>>
>> --
>> To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> the body to majordomo@kvack.org. For more info on Linux MM,
>> see: http://www.linux-mm.org/ .
>> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0
2013-06-20 1:44 ` Joonsoo Kim
2013-06-20 2:32 ` Wanpeng Li
@ 2013-06-20 2:32 ` Wanpeng Li
1 sibling, 0 replies; 11+ messages in thread
From: Wanpeng Li @ 2013-06-20 2:32 UTC (permalink / raw)
To: Joonsoo Kim
Cc: Pekka Enberg, Christoph Lameter, Matt Mackall, linux-mm,
linux-kernel
On Thu, Jun 20, 2013 at 10:44:40AM +0900, Joonsoo Kim wrote:
>On Thu, Jun 20, 2013 at 08:26:03AM +0800, Wanpeng Li wrote:
>> On Wed, Jun 19, 2013 at 05:52:50PM +0900, Joonsoo Kim wrote:
>> >On Wed, Jun 19, 2013 at 04:00:32PM +0800, Wanpeng Li wrote:
>> >> On Wed, Jun 19, 2013 at 03:33:55PM +0900, Joonsoo Kim wrote:
>> >> >In free path, we don't check number of cpu_partial, so one slab can
>> >> >be linked in cpu partial list even if cpu_partial is 0. To prevent this,
>> >> >we should check number of cpu_partial in put_cpu_partial().
>> >> >
>> >>
>> >> How about skip get_partial entirely? put_cpu_partial is called
>> >> in two paths, one is during refill cpu partial lists in alloc
>> >> slow path, the other is in free slow path. And cpu_partial is 0
>> >> just in debug mode.
>> >>
>> >> - alloc slow path, there is unnecessary to call get_partial
>> >> since cpu partial lists won't be used in debug mode.
>> >> - free slow patch, new.inuse won't be true in debug mode
>> >> which lead to put_cpu_partial won't be called.
>> >>
>> >
>> >In debug mode, put_cpu_partial() can't be called already on both path.
>> >But, if we assign 0 to cpu_partial via sysfs, put_cpu_partial() will be called
>> >on free slow path. On alloc slow path, it can't be called, because following
>> >test in get_partial_node() is always failed.
>> >
>> >available > s->cpu_partial / 2
>>
>> Is it always true? We can freeze slab from partial list, and
>> s->cpu_partial is 0.
>
>Do you mean node partial list?
>
Yup.
>At first, acquire_slab() is called for a cpu slab(not cpu partial list)
>in get_partial_node(), and then, check above test. In this time, available
>is always higher than 0, so, if we assign 0 to s->cpu_partial, we break
>the loop and we don't try to get a slab for cpu partial list.
>
Agreed.
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
>Thanks.
>
>>
>> Regards,
>> Wanpeng Li
>>
>> >
>> >Thanks.
>> >
>> >> Regards,
>> >> Wanpeng Li
>> >>
>> >> >Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>> >> >
>> >> >diff --git a/mm/slub.c b/mm/slub.c
>> >> >index 57707f0..7033b4f 100644
>> >> >--- a/mm/slub.c
>> >> >+++ b/mm/slub.c
>> >> >@@ -1955,6 +1955,9 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
>> >> > int pages;
>> >> > int pobjects;
>> >> >
>> >> >+ if (!s->cpu_partial)
>> >> >+ return;
>> >> >+
>> >> > do {
>> >> > pages = 0;
>> >> > pobjects = 0;
>> >> >--
>> >> >1.7.9.5
>> >> >
>> >> >--
>> >> >To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> >> >the body to majordomo@kvack.org. For more info on Linux MM,
>> >> >see: http://www.linux-mm.org/ .
>> >> >Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>> >>
>> >> --
>> >> To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> >> the body to majordomo@kvack.org. For more info on Linux MM,
>> >> see: http://www.linux-mm.org/ .
>> >> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>>
>> --
>> To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> the body to majordomo@kvack.org. For more info on Linux MM,
>> see: http://www.linux-mm.org/ .
>> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0
2013-06-19 6:33 [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0 Joonsoo Kim
` (3 preceding siblings ...)
2013-06-19 14:25 ` Christoph Lameter
@ 2013-07-07 15:47 ` Pekka Enberg
4 siblings, 0 replies; 11+ messages in thread
From: Pekka Enberg @ 2013-07-07 15:47 UTC (permalink / raw)
To: Joonsoo Kim; +Cc: Christoph Lameter, Matt Mackall, linux-mm@kvack.org, LKML
On Wed, Jun 19, 2013 at 9:33 AM, Joonsoo Kim <iamjoonsoo.kim@lge.com> wrote:
> In free path, we don't check number of cpu_partial, so one slab can
> be linked in cpu partial list even if cpu_partial is 0. To prevent this,
> we should check number of cpu_partial in put_cpu_partial().
>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Applied, thanks a lot!
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-07-07 15:47 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-19 6:33 [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0 Joonsoo Kim
2013-06-19 8:00 ` Wanpeng Li
2013-06-19 8:00 ` Wanpeng Li
[not found] ` <51c1652d.246e320a.4057.ffffed4fSMTPIN_ADDED_BROKEN@mx.google.com>
2013-06-19 8:52 ` Joonsoo Kim
2013-06-20 0:26 ` Wanpeng Li
2013-06-20 0:26 ` Wanpeng Li
[not found] ` <51c24c29.425c320a.433e.ffff9d8fSMTPIN_ADDED_BROKEN@mx.google.com>
2013-06-20 1:44 ` Joonsoo Kim
2013-06-20 2:32 ` Wanpeng Li
2013-06-20 2:32 ` Wanpeng Li
2013-06-19 14:25 ` Christoph Lameter
2013-07-07 15:47 ` Pekka Enberg
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).