* [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
@ 2007-05-24 23:57 akpm, Andrew Morton
2007-05-25 7:02 ` Peter Zijlstra
2007-05-25 14:43 ` Rik van Riel
0 siblings, 2 replies; 15+ messages in thread
From: akpm, Andrew Morton @ 2007-05-24 23:57 UTC (permalink / raw)
To: linux-mm; +Cc: akpm, mbligh, riel
Martin spotted this.
In the original rmap conversion in 2.5.32 we broke aging of pagecache pages on
the active list: we deactivate these pages even if they had PG_referenced set.
We should instead clear PG_referenced and give these pages another trip around
the active list.
We have basically no way of working out whether or not this change will
benefit or worsen anything.
Cc: Martin Bligh <mbligh@mbligh.org>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/vmscan.c | 3 +++
1 files changed, 3 insertions(+)
diff -puN mm/vmscan.c~vmscan-give-referenced-active-and-unmapped-pages-a-second-trip-around-the-lru mm/vmscan.c
--- a/mm/vmscan.c~vmscan-give-referenced-active-and-unmapped-pages-a-second-trip-around-the-lru
+++ a/mm/vmscan.c
@@ -836,6 +836,9 @@ force_reclaim_mapped:
list_add(&page->lru, &l_active);
continue;
}
+ } else if (TestClearPageReferenced(page)) {
+ list_add(&page->lru, &l_active);
+ continue;
}
list_add(&page->lru, &l_inactive);
}
_
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-24 23:57 [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU akpm, Andrew Morton
@ 2007-05-25 7:02 ` Peter Zijlstra
2007-05-25 7:18 ` Andrew Morton
2007-05-25 14:50 ` Rik van Riel
2007-05-25 14:43 ` Rik van Riel
1 sibling, 2 replies; 15+ messages in thread
From: Peter Zijlstra @ 2007-05-25 7:02 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, mbligh, riel
On Thu, 2007-05-24 at 16:57 -0700, akpm@linux-foundation.org wrote:
> Martin spotted this.
>
> In the original rmap conversion in 2.5.32 we broke aging of pagecache pages on
> the active list: we deactivate these pages even if they had PG_referenced set.
>
> We should instead clear PG_referenced and give these pages another trip around
> the active list.
>
> We have basically no way of working out whether or not this change will
> benefit or worsen anything.
>
> Cc: Martin Bligh <mbligh@mbligh.org>
> Cc: Rik van Riel <riel@redhat.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> mm/vmscan.c | 3 +++
> 1 files changed, 3 insertions(+)
>
> diff -puN mm/vmscan.c~vmscan-give-referenced-active-and-unmapped-pages-a-second-trip-around-the-lru mm/vmscan.c
> --- a/mm/vmscan.c~vmscan-give-referenced-active-and-unmapped-pages-a-second-trip-around-the-lru
> +++ a/mm/vmscan.c
> @@ -836,6 +836,9 @@ force_reclaim_mapped:
> list_add(&page->lru, &l_active);
> continue;
> }
> + } else if (TestClearPageReferenced(page)) {
> + list_add(&page->lru, &l_active);
> + continue;
> }
> list_add(&page->lru, &l_inactive);
> }
I myself prefer a patch like this:
---
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 53ad8ee..5addda9 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -957,16 +957,17 @@ force_reclaim_mapped:
spin_unlock_irq(&zone->lru_lock);
while (!list_empty(&l_hold)) {
+ int referenced;
+
cond_resched();
page = lru_to_page(&l_hold);
list_del(&page->lru);
- if (page_mapped(page)) {
- if (!reclaim_mapped ||
- (total_swap_pages == 0 && PageAnon(page)) ||
- page_referenced(page, 0)) {
- list_add(&page->lru, &l_active);
- continue;
- }
+
+ referenced = page_referenced(page, 0);
+ if (referenced || (page_mapped(page) && !reclaim_mapped) ||
+ (total_swap_pages == 0 && PageAnon(page))) {
+ list_add(&page->lru, &l_active);
+ continue;
}
list_add(&page->lru, &l_inactive);
}
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-25 7:02 ` Peter Zijlstra
@ 2007-05-25 7:18 ` Andrew Morton
2007-05-25 7:23 ` Peter Zijlstra
2007-05-25 14:50 ` Rik van Riel
1 sibling, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2007-05-25 7:18 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: linux-mm, mbligh, riel
On Fri, 25 May 2007 09:02:45 +0200 Peter Zijlstra <peterz@infradead.org> wrote:
> > + } else if (TestClearPageReferenced(page)) {
> > + list_add(&page->lru, &l_active);
> > + continue;
> > }
> > list_add(&page->lru, &l_inactive);
> > }
>
> I myself prefer a patch like this:
>
> ---
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 53ad8ee..5addda9 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -957,16 +957,17 @@ force_reclaim_mapped:
> spin_unlock_irq(&zone->lru_lock);
>
> while (!list_empty(&l_hold)) {
> + int referenced;
> +
> cond_resched();
> page = lru_to_page(&l_hold);
> list_del(&page->lru);
> - if (page_mapped(page)) {
> - if (!reclaim_mapped ||
> - (total_swap_pages == 0 && PageAnon(page)) ||
> - page_referenced(page, 0)) {
> - list_add(&page->lru, &l_active);
> - continue;
> - }
> +
> + referenced = page_referenced(page, 0);
> + if (referenced || (page_mapped(page) && !reclaim_mapped) ||
> + (total_swap_pages == 0 && PageAnon(page))) {
> + list_add(&page->lru, &l_active);
> + continue;
> }
> list_add(&page->lru, &l_inactive);
> }
That does a bit of extra work in the !PageReferenced && !page_mapped case,
but whatever.
The question is: what effect does the change have on page reclaim
effectiveness? And how much more swappy does it become? And
how much more oom-killery?
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-25 7:18 ` Andrew Morton
@ 2007-05-25 7:23 ` Peter Zijlstra
2007-05-25 7:28 ` Andrew Morton
0 siblings, 1 reply; 15+ messages in thread
From: Peter Zijlstra @ 2007-05-25 7:23 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, mbligh, riel
On Fri, 2007-05-25 at 00:18 -0700, Andrew Morton wrote:
> On Fri, 25 May 2007 09:02:45 +0200 Peter Zijlstra <peterz@infradead.org> wrote:
>
> > > + } else if (TestClearPageReferenced(page)) {
> > > + list_add(&page->lru, &l_active);
> > > + continue;
> > > }
> > > list_add(&page->lru, &l_inactive);
> > > }
> >
> > I myself prefer a patch like this:
> >
> > ---
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index 53ad8ee..5addda9 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -957,16 +957,17 @@ force_reclaim_mapped:
> > spin_unlock_irq(&zone->lru_lock);
> >
> > while (!list_empty(&l_hold)) {
> > + int referenced;
> > +
> > cond_resched();
> > page = lru_to_page(&l_hold);
> > list_del(&page->lru);
> > - if (page_mapped(page)) {
> > - if (!reclaim_mapped ||
> > - (total_swap_pages == 0 && PageAnon(page)) ||
> > - page_referenced(page, 0)) {
> > - list_add(&page->lru, &l_active);
> > - continue;
> > - }
> > +
> > + referenced = page_referenced(page, 0);
> > + if (referenced || (page_mapped(page) && !reclaim_mapped) ||
> > + (total_swap_pages == 0 && PageAnon(page))) {
> > + list_add(&page->lru, &l_active);
> > + continue;
> > }
> > list_add(&page->lru, &l_inactive);
> > }
>
> That does a bit of extra work in the !PageReferenced && !page_mapped case,
> but whatever.
>
> The question is: what effect does the change have on page reclaim
> effectiveness? And how much more swappy does it become? And
> how much more oom-killery?
All very good questions, of which I'd like to know the answers too :-(
I'm sitting on a huge pile of reclaim code, and have no real way of
answering these questions; I did start writing some synthetic benchmark
suite, but never really finished it - perhaps I ought to dive into that
again after OLS.
The trouble I had with the previous patch is that it somehow looks to
PG_referenced but not the PTE state, that seems wrong to me.
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-25 7:23 ` Peter Zijlstra
@ 2007-05-25 7:28 ` Andrew Morton
2007-05-25 7:36 ` Peter Zijlstra
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2007-05-25 7:28 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: linux-mm, mbligh, riel
On Fri, 25 May 2007 09:23:30 +0200 Peter Zijlstra <peterz@infradead.org> wrote:
> > > }
> > > list_add(&page->lru, &l_inactive);
> > > }
> >
> > That does a bit of extra work in the !PageReferenced && !page_mapped case,
> > but whatever.
> >
> > The question is: what effect does the change have on page reclaim
> > effectiveness? And how much more swappy does it become? And
> > how much more oom-killery?
>
> All very good questions, of which I'd like to know the answers too :-(
hm. We've always had this problem.
> I'm sitting on a huge pile of reclaim code, and have no real way of
> answering these questions; I did start writing some synthetic benchmark
> suite, but never really finished it - perhaps I ought to dive into that
> again after OLS.
hm.
> The trouble I had with the previous patch is that it somehow looks to
> PG_referenced but not the PTE state, that seems wrong to me.
if (page_mapped(page)) {
if (!reclaim_mapped ||
(total_swap_pages == 0 && PageAnon(page)) ||
page_referenced(page, 0)) {
list_add(&page->lru, &l_active);
continue;
}
} else if (TestClearPageReferenced(page)) {
list_add(&page->lru, &l_active);
continue;
}
When we run TestClearPageReferenced() we know that the page isn't
page_mapped(): there aren't any pte's which refer to it.
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-25 7:28 ` Andrew Morton
@ 2007-05-25 7:36 ` Peter Zijlstra
2007-05-25 7:48 ` Andrew Morton
0 siblings, 1 reply; 15+ messages in thread
From: Peter Zijlstra @ 2007-05-25 7:36 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, mbligh, riel
On Fri, 2007-05-25 at 00:28 -0700, Andrew Morton wrote:
> On Fri, 25 May 2007 09:23:30 +0200 Peter Zijlstra <peterz@infradead.org> wrote:
>
> > > > }
> > > > list_add(&page->lru, &l_inactive);
> > > > }
> > >
> > > That does a bit of extra work in the !PageReferenced && !page_mapped case,
> > > but whatever.
> > >
> > > The question is: what effect does the change have on page reclaim
> > > effectiveness? And how much more swappy does it become? And
> > > how much more oom-killery?
> >
> > All very good questions, of which I'd like to know the answers too :-(
>
> hm. We've always had this problem.
>
> > I'm sitting on a huge pile of reclaim code, and have no real way of
> > answering these questions; I did start writing some synthetic benchmark
> > suite, but never really finished it - perhaps I ought to dive into that
> > again after OLS.
>
> hm.
>
> > The trouble I had with the previous patch is that it somehow looks to
> > PG_referenced but not the PTE state, that seems wrong to me.
>
> if (page_mapped(page)) {
> if (!reclaim_mapped ||
> (total_swap_pages == 0 && PageAnon(page)) ||
> page_referenced(page, 0)) {
> list_add(&page->lru, &l_active);
> continue;
> }
> } else if (TestClearPageReferenced(page)) {
> list_add(&page->lru, &l_active);
> continue;
> }
>
> When we run TestClearPageReferenced() we know that the page isn't
> page_mapped(): there aren't any pte's which refer to it.
D'0h, I guess I need my morning juice...
OK, that was my biggest beef - another small nit: I think it should do
the page_referenced() first, and then the other checks (in the
page_mapped() branch). Otherwise we might 'leak' the referenced state
and give it yet another cycle on the active list - even though it was
not used since last we were here.
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-25 7:36 ` Peter Zijlstra
@ 2007-05-25 7:48 ` Andrew Morton
2007-05-25 7:51 ` Peter Zijlstra
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2007-05-25 7:48 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: linux-mm, mbligh, riel
On Fri, 25 May 2007 09:36:30 +0200 Peter Zijlstra <peterz@infradead.org> wrote:
> > > The trouble I had with the previous patch is that it somehow looks to
> > > PG_referenced but not the PTE state, that seems wrong to me.
> >
> > if (page_mapped(page)) {
> > if (!reclaim_mapped ||
> > (total_swap_pages == 0 && PageAnon(page)) ||
> > page_referenced(page, 0)) {
> > list_add(&page->lru, &l_active);
> > continue;
> > }
> > } else if (TestClearPageReferenced(page)) {
> > list_add(&page->lru, &l_active);
> > continue;
> > }
> >
> > When we run TestClearPageReferenced() we know that the page isn't
> > page_mapped(): there aren't any pte's which refer to it.
>
> D'0h, I guess I need my morning juice...
>
> OK, that was my biggest beef - another small nit: I think it should do
> the page_referenced() first, and then the other checks (in the
> page_mapped() branch). Otherwise we might 'leak' the referenced state
> and give it yet another cycle on the active list - even though it was
> not used since last we were here.
You're saying we whould run page_referenced() prior to testing
reclaim_mapped?
That's quite a large change in behaviour: when reclaim is having an easy
time, (say, reclaiming clean pagecache), a change like that would cause
more pte-refenced bits to be cleared and it would cause more clearing of
PG_referenced on mapped pages. Net effect: mapped pages get deactivated
and reclaimed more easily.
It's also significantly more computationally expensive: more rmap walking,
more lock-taking, more tlb writeback when those ptes get dirtied. Not that
reclaim is very CPU-intensive.
But hey, like any change in there it might make reclaim better. Or worse.
Or pink with shiny spots. We just don't know.
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-25 7:48 ` Andrew Morton
@ 2007-05-25 7:51 ` Peter Zijlstra
2007-05-25 8:01 ` Andrew Morton
0 siblings, 1 reply; 15+ messages in thread
From: Peter Zijlstra @ 2007-05-25 7:51 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, mbligh, riel
On Fri, 2007-05-25 at 00:48 -0700, Andrew Morton wrote:
> On Fri, 25 May 2007 09:36:30 +0200 Peter Zijlstra <peterz@infradead.org> wrote:
>
> > > > The trouble I had with the previous patch is that it somehow looks to
> > > > PG_referenced but not the PTE state, that seems wrong to me.
> > >
> > > if (page_mapped(page)) {
> > > if (!reclaim_mapped ||
> > > (total_swap_pages == 0 && PageAnon(page)) ||
> > > page_referenced(page, 0)) {
> > > list_add(&page->lru, &l_active);
> > > continue;
> > > }
> > > } else if (TestClearPageReferenced(page)) {
> > > list_add(&page->lru, &l_active);
> > > continue;
> > > }
> > >
> > > When we run TestClearPageReferenced() we know that the page isn't
> > > page_mapped(): there aren't any pte's which refer to it.
> >
> > D'0h, I guess I need my morning juice...
> >
> > OK, that was my biggest beef - another small nit: I think it should do
> > the page_referenced() first, and then the other checks (in the
> > page_mapped() branch). Otherwise we might 'leak' the referenced state
> > and give it yet another cycle on the active list - even though it was
> > not used since last we were here.
>
> You're saying we whould run page_referenced() prior to testing
> reclaim_mapped?
yep
> That's quite a large change in behaviour: when reclaim is having an easy
> time, (say, reclaiming clean pagecache), a change like that would cause
> more pte-refenced bits to be cleared and it would cause more clearing of
> PG_referenced on mapped pages. Net effect: mapped pages get deactivated
> and reclaimed more easily.
*nod*
> It's also significantly more computationally expensive: more rmap walking,
> more lock-taking, more tlb writeback when those ptes get dirtied. Not that
> reclaim is very CPU-intensive.
>
>
> But hey, like any change in there it might make reclaim better. Or worse.
> Or pink with shiny spots. We just don't know.
:-/
Pick my code if you feel particularly lucky today, otherwise the
original will do just fine.
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-25 7:51 ` Peter Zijlstra
@ 2007-05-25 8:01 ` Andrew Morton
2007-05-25 8:35 ` Peter Zijlstra
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2007-05-25 8:01 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: linux-mm, mbligh, riel
On Fri, 25 May 2007 09:51:19 +0200 Peter Zijlstra <peterz@infradead.org> wrote:
> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
But why? It might make the VM suck. Or swap more. Or go oom.
I don't know how to justify merging this.
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-25 8:01 ` Andrew Morton
@ 2007-05-25 8:35 ` Peter Zijlstra
2007-05-25 8:43 ` Andrew Morton
0 siblings, 1 reply; 15+ messages in thread
From: Peter Zijlstra @ 2007-05-25 8:35 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, mbligh, riel
On Fri, 2007-05-25 at 01:01 -0700, Andrew Morton wrote:
> On Fri, 25 May 2007 09:51:19 +0200 Peter Zijlstra <peterz@infradead.org> wrote:
>
> > Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
>
> But why? It might make the VM suck. Or swap more. Or go oom.
>
> I don't know how to justify merging this.
/me a tad confused here - what patch are we discussing?
The ACK was for your initial patch.
As for my patch - yes I understand that that would be difficult, but
sometimes you seem to just toss things in to see how they work out (one
can always hope, right :-)
As for the rationale: not clearing the referenced state when we do give
the page another go on the active list, means it will get yet another
one when we finally do check it (and reclaim_mapped is deemed ok).
Not doing it basically gives all those pages another go after
reclaim_mapped is set.
I realise this is not backed up by evidence of actual tests,.. :-(
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-25 8:35 ` Peter Zijlstra
@ 2007-05-25 8:43 ` Andrew Morton
2007-05-25 10:13 ` Peter Zijlstra
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2007-05-25 8:43 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: linux-mm, mbligh, riel
On Fri, 25 May 2007 10:35:24 +0200 Peter Zijlstra <peterz@infradead.org> wrote:
> On Fri, 2007-05-25 at 01:01 -0700, Andrew Morton wrote:
> > On Fri, 25 May 2007 09:51:19 +0200 Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > > Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> >
> > But why? It might make the VM suck. Or swap more. Or go oom.
> >
> > I don't know how to justify merging this.
>
> /me a tad confused here - what patch are we discussing?
> The ACK was for your initial patch.
Yup, that patch.
> As for my patch - yes I understand that that would be difficult, but
> sometimes you seem to just toss things in to see how they work out (one
> can always hope, right :-)
>
> As for the rationale: not clearing the referenced state when we do give
> the page another go on the active list, means it will get yet another
> one when we finally do check it (and reclaim_mapped is deemed ok).
>
> Not doing it basically gives all those pages another go after
> reclaim_mapped is set.
>
> I realise this is not backed up by evidence of actual tests,.. :-(
Well yeah. I look at this patch and I can say with confidence that it will
increase our tendency to swap and that it'll cause reclaim to scan more
pages and that it'll increase the ease with which we declare oom.
otoh it takes us closer to the designed 4-stage page aging. But does it
actually make the kernel better? Unknown and unknowable.
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-25 8:43 ` Andrew Morton
@ 2007-05-25 10:13 ` Peter Zijlstra
0 siblings, 0 replies; 15+ messages in thread
From: Peter Zijlstra @ 2007-05-25 10:13 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, mbligh, riel
On Fri, 2007-05-25 at 01:43 -0700, Andrew Morton wrote:
> Well yeah. I look at this patch and I can say with confidence that it will
> increase our tendency to swap and that it'll cause reclaim to scan more
> pages and that it'll increase the ease with which we declare oom.
>
> otoh it takes us closer to the designed 4-stage page aging. But does it
> actually make the kernel better? Unknown and unknowable.
Ah, here I see my mistake and your confusion; I actually thought the
design mattered :-)
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-24 23:57 [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU akpm, Andrew Morton
2007-05-25 7:02 ` Peter Zijlstra
@ 2007-05-25 14:43 ` Rik van Riel
2007-05-25 17:20 ` Andrew Morton
1 sibling, 1 reply; 15+ messages in thread
From: Rik van Riel @ 2007-05-25 14:43 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, mbligh
akpm@linux-foundation.org wrote:
> From: Andrew Morton <akpm@linux-foundation.org>
>
> Martin spotted this.
>
> In the original rmap conversion in 2.5.32 we broke aging of pagecache pages on
> the active list: we deactivate these pages even if they had PG_referenced set.
IIRC this is done to make sure that we reclaim page cache pages
ahead of mapped anonymous pages.
> We should instead clear PG_referenced and give these pages another trip around
> the active list.
A side effect of this is that the page will now need TWO references
to be promoted back to the active list from the inactive list.
The current code leaves PG_referenced set, so that the first access
to a page cache page that was demoted to the inactive list will cause
that page to be moved back to the active list.
--
Politics is the struggle between those who want to make their country
the best in the world, and those who believe it already is. Each group
calls the other unpatriotic.
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-25 7:02 ` Peter Zijlstra
2007-05-25 7:18 ` Andrew Morton
@ 2007-05-25 14:50 ` Rik van Riel
1 sibling, 0 replies; 15+ messages in thread
From: Rik van Riel @ 2007-05-25 14:50 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: akpm, linux-mm, mbligh
Peter Zijlstra wrote:
> - if (page_mapped(page)) {
> - if (!reclaim_mapped ||
> - (total_swap_pages == 0 && PageAnon(page)) ||
> - page_referenced(page, 0)) {
> - list_add(&page->lru, &l_active);
> - continue;
This code is problematic, too. We essentially randomize the
LRU order of the mapped pages while !reclaim_mapped, while
clearing the referenced bits on those pages.
By the time we start swapping out mapped pages, the list has
been randomized and replacement starts getting pretty bad.
Of course, these problems are pretty small compared to how
my 2GB test system misbehaves when running AIM7.
When the system runs out of memory, everything starts swapping
all at once. Unfortunately vmstat got stuck too, so I could
not observe the start of swapping. Once the system had freed
up 900MB (of 2GB total RAM!), vmstat returned. The system did
not stop swapping until 1.4GB of memory was free!
With the system behaving this badly at a macro level, I do
not think page reclaim tweaks can be usefully tested...
--
Politics is the struggle between those who want to make their country
the best in the world, and those who believe it already is. Each group
calls the other unpatriotic.
--
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] 15+ messages in thread
* Re: [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU
2007-05-25 14:43 ` Rik van Riel
@ 2007-05-25 17:20 ` Andrew Morton
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Morton @ 2007-05-25 17:20 UTC (permalink / raw)
To: Rik van Riel; +Cc: linux-mm, mbligh
On Fri, 25 May 2007 10:43:49 -0400 Rik van Riel <riel@redhat.com> wrote:
> akpm@linux-foundation.org wrote:
> > From: Andrew Morton <akpm@linux-foundation.org>
> >
> > Martin spotted this.
> >
> > In the original rmap conversion in 2.5.32 we broke aging of pagecache pages on
> > the active list: we deactivate these pages even if they had PG_referenced set.
>
> IIRC this is done to make sure that we reclaim page cache pages
> ahead of mapped anonymous pages.
I think it was an accident. At least, that 2.5.32 change was uncommented
and unchangelogged and was an inappropriate thing to have been bundled into
that patch.
> > We should instead clear PG_referenced and give these pages another trip around
> > the active list.
>
> A side effect of this is that the page will now need TWO references
> to be promoted back to the active list from the inactive list.
>
> The current code leaves PG_referenced set, so that the first access
> to a page cache page that was demoted to the inactive list will cause
> that page to be moved back to the active list.
hm, yeah, we should be setting PG-referenced when moving a page from the
active list onto the inactive list.
--
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] 15+ messages in thread
end of thread, other threads:[~2007-05-25 17:20 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-24 23:57 [patch 1/1] vmscan: give referenced, active and unmapped pages a second trip around the LRU akpm, Andrew Morton
2007-05-25 7:02 ` Peter Zijlstra
2007-05-25 7:18 ` Andrew Morton
2007-05-25 7:23 ` Peter Zijlstra
2007-05-25 7:28 ` Andrew Morton
2007-05-25 7:36 ` Peter Zijlstra
2007-05-25 7:48 ` Andrew Morton
2007-05-25 7:51 ` Peter Zijlstra
2007-05-25 8:01 ` Andrew Morton
2007-05-25 8:35 ` Peter Zijlstra
2007-05-25 8:43 ` Andrew Morton
2007-05-25 10:13 ` Peter Zijlstra
2007-05-25 14:50 ` Rik van Riel
2007-05-25 14:43 ` Rik van Riel
2007-05-25 17:20 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox