* [patch 1/3] mm: SLUB fix reclaim_state
[not found] <20090505091343.706910164@suse.de>
@ 2009-05-05 9:13 ` npiggin
2009-05-05 13:46 ` Christoph Lameter
2009-05-06 7:20 ` Pekka Enberg
2009-05-05 9:13 ` [patch 2/3] mm: SLOB " npiggin
2009-05-05 9:13 ` [patch 3/3] mm: SLQB " npiggin
2 siblings, 2 replies; 13+ messages in thread
From: npiggin @ 2009-05-05 9:13 UTC (permalink / raw)
To: penberg; +Cc: stable, linux-mm, Matt Mackall, Christoph Lameter
[-- Attachment #1: mm-slub-fix-reclaim_state.patch --]
[-- Type: text/plain, Size: 1185 bytes --]
SLUB does not correctly account reclaim_state.reclaimed_slab, so it will
break memory reclaim. Account it like SLAB does.
Cc: stable@kernel.org
Cc: linux-mm@kvack.org
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Christoph Lameter <cl@linux.com>
Signed-off-by: Nick Piggin <npiggin@suse.de>
---
mm/slub.c | 3 +++
1 file changed, 3 insertions(+)
Index: linux-2.6/mm/slub.c
===================================================================
--- linux-2.6.orig/mm/slub.c
+++ linux-2.6/mm/slub.c
@@ -9,6 +9,7 @@
*/
#include <linux/mm.h>
+#include <linux/swap.h> /* struct reclaim_state */
#include <linux/module.h>
#include <linux/bit_spinlock.h>
#include <linux/interrupt.h>
@@ -1170,6 +1171,8 @@ static void __free_slab(struct kmem_cach
__ClearPageSlab(page);
reset_page_mapcount(page);
+ if (current->reclaim_state)
+ current->reclaim_state->reclaimed_slab += pages;
__free_pages(page, order);
}
--
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] 13+ messages in thread
* [patch 2/3] mm: SLOB fix reclaim_state
[not found] <20090505091343.706910164@suse.de>
2009-05-05 9:13 ` [patch 1/3] mm: SLUB fix reclaim_state npiggin
@ 2009-05-05 9:13 ` npiggin
2009-05-05 13:47 ` Christoph Lameter
2009-05-05 16:47 ` Matt Mackall
2009-05-05 9:13 ` [patch 3/3] mm: SLQB " npiggin
2 siblings, 2 replies; 13+ messages in thread
From: npiggin @ 2009-05-05 9:13 UTC (permalink / raw)
To: penberg; +Cc: stable, linux-mm, Matt Mackall, Christoph Lameter
[-- Attachment #1: mm-slob-fix-reclaim_state.patch --]
[-- Type: text/plain, Size: 1477 bytes --]
SLOB does not correctly account reclaim_state.reclaimed_slab, so it will
break memory reclaim. Account it like SLAB does.
Cc: stable@kernel.org
Cc: linux-mm@kvack.org
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Christoph Lameter <cl@linux.com>
Signed-off-by: Nick Piggin <npiggin@suse.de>
---
mm/slob.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: linux-2.6/mm/slob.c
===================================================================
--- linux-2.6.orig/mm/slob.c
+++ linux-2.6/mm/slob.c
@@ -60,6 +60,7 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/mm.h>
+#include <linux/swap.h> /* struct reclaim_state */
#include <linux/cache.h>
#include <linux/init.h>
#include <linux/module.h>
@@ -255,6 +256,8 @@ static void *slob_new_pages(gfp_t gfp, i
static void slob_free_pages(void *b, int order)
{
+ if (current->reclaim_state)
+ current->reclaim_state->reclaimed_slab += 1 << order;
free_pages((unsigned long)b, order);
}
@@ -407,7 +410,7 @@ static void slob_free(void *block, int s
spin_unlock_irqrestore(&slob_lock, flags);
clear_slob_page(sp);
free_slob_page(sp);
- free_page((unsigned long)b);
+ slob_free_pages(b, 0);
return;
}
--
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] 13+ messages in thread
* [patch 3/3] mm: SLQB fix reclaim_state
[not found] <20090505091343.706910164@suse.de>
2009-05-05 9:13 ` [patch 1/3] mm: SLUB fix reclaim_state npiggin
2009-05-05 9:13 ` [patch 2/3] mm: SLOB " npiggin
@ 2009-05-05 9:13 ` npiggin
2009-05-05 13:47 ` Christoph Lameter
2 siblings, 1 reply; 13+ messages in thread
From: npiggin @ 2009-05-05 9:13 UTC (permalink / raw)
To: penberg; +Cc: stable, linux-mm, Matt Mackall, Christoph Lameter
[-- Attachment #1: mm-slqb-fix-reclaim_state.patch --]
[-- Type: text/plain, Size: 1781 bytes --]
SLQB does not correctly account reclaim_state.reclaimed_slab, so it will
break memory reclaim. Account it like SLAB does.
Cc: stable@kernel.org
Cc: linux-mm@kvack.org
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Christoph Lameter <cl@linux.com>
Signed-off-by: Nick Piggin <npiggin@suse.de>
---
mm/slqb.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: linux-2.6/mm/slqb.c
===================================================================
--- linux-2.6.orig/mm/slqb.c
+++ linux-2.6/mm/slqb.c
@@ -8,6 +8,7 @@
*/
#include <linux/mm.h>
+#include <linux/swap.h> /* struct reclaim_state */
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
@@ -178,7 +179,8 @@ static inline struct slqb_page *virt_to_
return (struct slqb_page *)p;
}
-static inline void __free_slqb_pages(struct slqb_page *page, unsigned int order)
+static inline void __free_slqb_pages(struct slqb_page *page, unsigned int order,
+ int pages)
{
struct page *p = &page->page;
@@ -187,6 +189,8 @@ static inline void __free_slqb_pages(str
VM_BUG_ON(!(p->flags & PG_SLQB_BIT));
p->flags &= ~PG_SLQB_BIT;
+ if (current->reclaim_state)
+ current->reclaim_state->reclaimed_slab += pages;
__free_pages(p, order);
}
@@ -1043,7 +1047,7 @@ static void __free_slab(struct kmem_cach
NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE,
-pages);
- __free_slqb_pages(page, s->order);
+ __free_slqb_pages(page, s->order, pages);
}
static void rcu_free_slab(struct rcu_head *h)
--
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] 13+ messages in thread
* Re: [patch 1/3] mm: SLUB fix reclaim_state
2009-05-05 9:13 ` [patch 1/3] mm: SLUB fix reclaim_state npiggin
@ 2009-05-05 13:46 ` Christoph Lameter
2009-05-06 7:20 ` Pekka Enberg
1 sibling, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2009-05-05 13:46 UTC (permalink / raw)
To: npiggin; +Cc: penberg, stable, linux-mm, Matt Mackall
Acked-by: Christoph Lameter <cl@linux-foundation.org>
--
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] 13+ messages in thread
* Re: [patch 2/3] mm: SLOB fix reclaim_state
2009-05-05 9:13 ` [patch 2/3] mm: SLOB " npiggin
@ 2009-05-05 13:47 ` Christoph Lameter
2009-05-05 16:47 ` Matt Mackall
1 sibling, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2009-05-05 13:47 UTC (permalink / raw)
To: npiggin; +Cc: penberg, stable, linux-mm, Matt Mackall
Acked-by: Christoph Lameter <cl@linux-foundation.org>
--
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] 13+ messages in thread
* Re: [patch 3/3] mm: SLQB fix reclaim_state
2009-05-05 9:13 ` [patch 3/3] mm: SLQB " npiggin
@ 2009-05-05 13:47 ` Christoph Lameter
0 siblings, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2009-05-05 13:47 UTC (permalink / raw)
To: npiggin; +Cc: penberg, stable, linux-mm, Matt Mackall
Acked-by: Christoph Lameter <cl@linux-foundation.org>
--
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] 13+ messages in thread
* Re: [patch 2/3] mm: SLOB fix reclaim_state
2009-05-05 9:13 ` [patch 2/3] mm: SLOB " npiggin
2009-05-05 13:47 ` Christoph Lameter
@ 2009-05-05 16:47 ` Matt Mackall
1 sibling, 0 replies; 13+ messages in thread
From: Matt Mackall @ 2009-05-05 16:47 UTC (permalink / raw)
To: npiggin; +Cc: penberg, stable, linux-mm, Christoph Lameter
On Tue, May 05, 2009 at 07:13:45PM +1000, npiggin@suse.de wrote:
> SLOB does not correctly account reclaim_state.reclaimed_slab, so it will
> break memory reclaim. Account it like SLAB does.
Acked-by: Matt Mackall <mpm@selenic.com>
--
Mathematics is the supreme nostalgia of our time.
--
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] 13+ messages in thread
* Re: [patch 1/3] mm: SLUB fix reclaim_state
2009-05-05 9:13 ` [patch 1/3] mm: SLUB fix reclaim_state npiggin
2009-05-05 13:46 ` Christoph Lameter
@ 2009-05-06 7:20 ` Pekka Enberg
2009-05-06 13:29 ` Christoph Lameter
` (3 more replies)
1 sibling, 4 replies; 13+ messages in thread
From: Pekka Enberg @ 2009-05-06 7:20 UTC (permalink / raw)
To: npiggin; +Cc: stable, linux-mm, Matt Mackall, Christoph Lameter, akpm
On Tue, 2009-05-05 at 19:13 +1000, npiggin@suse.de wrote:
> plain text document attachment (mm-slub-fix-reclaim_state.patch)
> SLUB does not correctly account reclaim_state.reclaimed_slab, so it will
> break memory reclaim. Account it like SLAB does.
>
> Cc: stable@kernel.org
> Cc: linux-mm@kvack.org
> Cc: Pekka Enberg <penberg@cs.helsinki.fi>
> Cc: Matt Mackall <mpm@selenic.com>
> Cc: Christoph Lameter <cl@linux.com>
> Signed-off-by: Nick Piggin <npiggin@suse.de>
I have applied the patch series. I see you have cc'd stable so I assume
you want this in 2.6.30, right? This seems like a rather serious bug but
I wonder why we've gotten away with it for so long? Is there a test
program or a known workload that breaks without this?
Pekka
--
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] 13+ messages in thread
* Re: [patch 1/3] mm: SLUB fix reclaim_state
2009-05-06 7:20 ` Pekka Enberg
@ 2009-05-06 13:29 ` Christoph Lameter
2009-05-06 13:42 ` Nick Piggin
` (2 subsequent siblings)
3 siblings, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2009-05-06 13:29 UTC (permalink / raw)
To: Pekka Enberg; +Cc: npiggin, stable, linux-mm, Matt Mackall, akpm
On Wed, 6 May 2009, Pekka Enberg wrote:
> I have applied the patch series. I see you have cc'd stable so I assume
> you want this in 2.6.30, right? This seems like a rather serious bug but
> I wonder why we've gotten away with it for so long? Is there a test
> program or a known workload that breaks without this?
You need to have a load that results in extensive slab reclaim so that the
slab pages in the reclaim path become a factor.
--
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] 13+ messages in thread
* Re: [patch 1/3] mm: SLUB fix reclaim_state
2009-05-06 7:20 ` Pekka Enberg
2009-05-06 13:29 ` Christoph Lameter
@ 2009-05-06 13:42 ` Nick Piggin
2009-05-07 8:50 ` Pekka Enberg
2009-05-06 16:02 ` Johannes Weiner
2009-05-06 16:34 ` Matt Mackall
3 siblings, 1 reply; 13+ messages in thread
From: Nick Piggin @ 2009-05-06 13:42 UTC (permalink / raw)
To: Pekka Enberg; +Cc: stable, linux-mm, Matt Mackall, Christoph Lameter, akpm
On Wed, May 06, 2009 at 10:20:30AM +0300, Pekka Enberg wrote:
> On Tue, 2009-05-05 at 19:13 +1000, npiggin@suse.de wrote:
> > plain text document attachment (mm-slub-fix-reclaim_state.patch)
> > SLUB does not correctly account reclaim_state.reclaimed_slab, so it will
> > break memory reclaim. Account it like SLAB does.
> >
> > Cc: stable@kernel.org
> > Cc: linux-mm@kvack.org
> > Cc: Pekka Enberg <penberg@cs.helsinki.fi>
> > Cc: Matt Mackall <mpm@selenic.com>
> > Cc: Christoph Lameter <cl@linux.com>
> > Signed-off-by: Nick Piggin <npiggin@suse.de>
>
> I have applied the patch series. I see you have cc'd stable so I assume
> you want this in 2.6.30, right? This seems like a rather serious bug but
Thanks. I think it makes sense to into 2.6.30. Also probably all active
.stable kernels.
> I wonder why we've gotten away with it for so long? Is there a test
> program or a known workload that breaks without this?
Well... it isn't doing what reclaim code wants, and it is differing
behaviour between SLAB and SL?B, so I think it is fairly safe to
merge these now.
It doesn't look like too much *significant* changes to heuristics, but
things will get skewed here and there.
--
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] 13+ messages in thread
* Re: [patch 1/3] mm: SLUB fix reclaim_state
2009-05-06 7:20 ` Pekka Enberg
2009-05-06 13:29 ` Christoph Lameter
2009-05-06 13:42 ` Nick Piggin
@ 2009-05-06 16:02 ` Johannes Weiner
2009-05-06 16:34 ` Matt Mackall
3 siblings, 0 replies; 13+ messages in thread
From: Johannes Weiner @ 2009-05-06 16:02 UTC (permalink / raw)
To: Pekka Enberg
Cc: npiggin, stable, linux-mm, Matt Mackall, Christoph Lameter, akpm
On Wed, May 06, 2009 at 10:20:30AM +0300, Pekka Enberg wrote:
> On Tue, 2009-05-05 at 19:13 +1000, npiggin@suse.de wrote:
> > plain text document attachment (mm-slub-fix-reclaim_state.patch)
> > SLUB does not correctly account reclaim_state.reclaimed_slab, so it will
> > break memory reclaim. Account it like SLAB does.
> >
> > Cc: stable@kernel.org
> > Cc: linux-mm@kvack.org
> > Cc: Pekka Enberg <penberg@cs.helsinki.fi>
> > Cc: Matt Mackall <mpm@selenic.com>
> > Cc: Christoph Lameter <cl@linux.com>
> > Signed-off-by: Nick Piggin <npiggin@suse.de>
>
> I have applied the patch series. I see you have cc'd stable so I assume
> you want this in 2.6.30, right? This seems like a rather serious bug but
> I wonder why we've gotten away with it for so long? Is there a test
> program or a known workload that breaks without this?
We might overreclaim a bit on the LRU lists, but not that much, as we
scan them in SWAP_CLUSTER_MAX (32 pages) steps only most of the time
and use the same value as a total goal.
So it will rescan the LRU lists if they didn't yield 32 pages, even if
slab cache pruning was more successful.
Only hibernation has a larger scan goal and it will then reclaim the
extra amount of LRU pages that it failed to account for slab pruning,
which might hurt with 15mb worth of reclaimable slab caches.
Hannes
--
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] 13+ messages in thread
* Re: [patch 1/3] mm: SLUB fix reclaim_state
2009-05-06 7:20 ` Pekka Enberg
` (2 preceding siblings ...)
2009-05-06 16:02 ` Johannes Weiner
@ 2009-05-06 16:34 ` Matt Mackall
3 siblings, 0 replies; 13+ messages in thread
From: Matt Mackall @ 2009-05-06 16:34 UTC (permalink / raw)
To: Pekka Enberg; +Cc: npiggin, stable, linux-mm, Christoph Lameter, akpm
On Wed, May 06, 2009 at 10:20:30AM +0300, Pekka Enberg wrote:
> On Tue, 2009-05-05 at 19:13 +1000, npiggin@suse.de wrote:
> > plain text document attachment (mm-slub-fix-reclaim_state.patch)
> > SLUB does not correctly account reclaim_state.reclaimed_slab, so it will
> > break memory reclaim. Account it like SLAB does.
> >
> > Cc: stable@kernel.org
> > Cc: linux-mm@kvack.org
> > Cc: Pekka Enberg <penberg@cs.helsinki.fi>
> > Cc: Matt Mackall <mpm@selenic.com>
> > Cc: Christoph Lameter <cl@linux.com>
> > Signed-off-by: Nick Piggin <npiggin@suse.de>
>
> I have applied the patch series. I see you have cc'd stable so I assume
> you want this in 2.6.30, right? This seems like a rather serious bug but
> I wonder why we've gotten away with it for so long? Is there a test
> program or a known workload that breaks without this?
Appears to me to be less a correctness than a balancing issue. reclaim
state is a back channel into the shrink code that says 'yes, this is
working'. Without it, things should still work, but possibly not as
smoothly.
--
Mathematics is the supreme nostalgia of our time.
--
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] 13+ messages in thread
* Re: [patch 1/3] mm: SLUB fix reclaim_state
2009-05-06 13:42 ` Nick Piggin
@ 2009-05-07 8:50 ` Pekka Enberg
0 siblings, 0 replies; 13+ messages in thread
From: Pekka Enberg @ 2009-05-07 8:50 UTC (permalink / raw)
To: Nick Piggin; +Cc: stable, linux-mm, Matt Mackall, Christoph Lameter, akpm
Hi Nick,
On Wed, 2009-05-06 at 15:42 +0200, Nick Piggin wrote:
> > I have applied the patch series. I see you have cc'd stable so I assume
> > you want this in 2.6.30, right? This seems like a rather serious bug but
>
> Thanks. I think it makes sense to into 2.6.30. Also probably all active
> .stable kernels.
>
>
> > I wonder why we've gotten away with it for so long? Is there a test
> > program or a known workload that breaks without this?
>
> Well... it isn't doing what reclaim code wants, and it is differing
> behaviour between SLAB and SL?B, so I think it is fairly safe to
> merge these now.
>
> It doesn't look like too much *significant* changes to heuristics, but
> things will get skewed here and there.
Yeah, that's my thinking too. Oh, well, I'll forward it to Linus' way
and let the stable guys decide whether they want to take it or not.
Pekka
--
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] 13+ messages in thread
end of thread, other threads:[~2009-05-07 8:49 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20090505091343.706910164@suse.de>
2009-05-05 9:13 ` [patch 1/3] mm: SLUB fix reclaim_state npiggin
2009-05-05 13:46 ` Christoph Lameter
2009-05-06 7:20 ` Pekka Enberg
2009-05-06 13:29 ` Christoph Lameter
2009-05-06 13:42 ` Nick Piggin
2009-05-07 8:50 ` Pekka Enberg
2009-05-06 16:02 ` Johannes Weiner
2009-05-06 16:34 ` Matt Mackall
2009-05-05 9:13 ` [patch 2/3] mm: SLOB " npiggin
2009-05-05 13:47 ` Christoph Lameter
2009-05-05 16:47 ` Matt Mackall
2009-05-05 9:13 ` [patch 3/3] mm: SLQB " npiggin
2009-05-05 13:47 ` Christoph Lameter
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.