* [PATCH] filemap.c fixes
@ 2001-05-14 4:00 Rik van Riel
2001-05-14 13:54 ` Daniel Phillips
0 siblings, 1 reply; 7+ messages in thread
From: Rik van Riel @ 2001-05-14 4:00 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel
Hi Linus,
here are a filemap.c fix and a slight addition:
1) __find_page_nolock should only set the referenced bit
on an active page, otherwise a number of subsequent
reads from the same page within one page scan interval
can SEVERELY mess up page aging to the disadvantage of
the other pages in the system ...
just setting the referenced bit on the page makes the
aging a lot fairer
2) in drop_behind() we first increase the page age and
will then proceed to deactivate the page again; better
have a simpler help function for this ... note that this
help function could also be used for eg. ->writepage()
write clustering code
regards,
Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...
http://www.surriel.com/ http://distro.conectiva.com/
Send all your spam to aardvark@nl.linux.org (spam digging piggy)
--- linux-2.4.5-pre1/mm/filemap.c.orig Mon May 14 00:55:53 2001
+++ linux-2.4.5-pre1/mm/filemap.c Mon May 14 00:56:03 2001
@@ -299,13 +299,14 @@
break;
}
/*
- * Touching the page may move it to the active list.
- * If we end up with too few inactive pages, we wake
- * up kswapd.
+ * Mark the page referenced, moving inactive pages to the
+ * active list.
*/
- age_page_up(page);
- if (inactive_shortage() > inactive_target / 2 && free_shortage())
- wakeup_kswapd();
+ if (!PageActive(page))
+ activate_page(page);
+ else
+ SetPageReferenced(page);
+
not_found:
return page;
}
@@ -783,8 +784,7 @@
*/
spin_lock(&pagecache_lock);
while (--index >= start) {
- hash = page_hash(mapping, index);
- page = __find_page_nolock(mapping, index, *hash);
+ page = __find_page_simple(mapping, index);
if (!page)
break;
deactivate_page(page);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] filemap.c fixes
2001-05-14 4:00 [PATCH] filemap.c fixes Rik van Riel
@ 2001-05-14 13:54 ` Daniel Phillips
2001-05-14 14:11 ` Rik van Riel
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Phillips @ 2001-05-14 13:54 UTC (permalink / raw)
To: Rik van Riel, Linus Torvalds; +Cc: linux-kernel
On Monday 14 May 2001 06:00, Rik van Riel wrote:
> + if (!PageActive(page))
> + activate_page(page);
> + else
> + SetPageReferenced(page);
> +
How about:
> + if (PageActive(page))
> + SetPageReferenced(page);
> + else
> + activate_page(page);
--
Daniel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] filemap.c fixes
2001-05-14 13:54 ` Daniel Phillips
@ 2001-05-14 14:11 ` Rik van Riel
2001-05-15 6:48 ` Linus Torvalds
0 siblings, 1 reply; 7+ messages in thread
From: Rik van Riel @ 2001-05-14 14:11 UTC (permalink / raw)
To: Daniel Phillips; +Cc: Linus Torvalds, linux-kernel
On Mon, 14 May 2001, Daniel Phillips wrote:
> On Monday 14 May 2001 06:00, Rik van Riel wrote:
>
> > + if (!PageActive(page))
> > + activate_page(page);
> > + else
> > + SetPageReferenced(page);
> > +
>
> How about:
>
> > + if (PageActive(page))
> > + SetPageReferenced(page);
> > + else
> > + activate_page(page);
Fine with me ...
Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...
http://www.surriel.com/ http://distro.conectiva.com/
Send all your spam to aardvark@nl.linux.org (spam digging piggy)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] filemap.c fixes
2001-05-14 14:11 ` Rik van Riel
@ 2001-05-15 6:48 ` Linus Torvalds
2001-05-15 15:12 ` Rik van Riel
0 siblings, 1 reply; 7+ messages in thread
From: Linus Torvalds @ 2001-05-15 6:48 UTC (permalink / raw)
To: Rik van Riel; +Cc: Daniel Phillips, linux-kernel
On Mon, 14 May 2001, Rik van Riel wrote:
> On Mon, 14 May 2001, Daniel Phillips wrote:
> >
> > How about:
> >
> > > + if (PageActive(page))
> > > + SetPageReferenced(page);
> > > + else
> > > + activate_page(page);
>
> Fine with me ...
Now, please explain to me why it's not just a simple
SetPageReferenced(page);
and then just moving it lazily from one queue to another..
Advantage: fast and robust. Very simple.
Disadvantage: lazy queue movement. But we're already doing that for other
things (ie page_launder() already has the logic to move pages with counts
and references to the active list). So this is nothing new.
The advantage of doing the work lazily is not just simplicity: it's
actually much _faster_ to delay the work until later, because in many
cases the work never needs to be done at all (ie we might not be low on
memory, or the page ends up being moved for other reasons anyway).
Comments?
Linus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] filemap.c fixes
2001-05-15 6:48 ` Linus Torvalds
@ 2001-05-15 15:12 ` Rik van Riel
2001-05-15 15:37 ` Linus Torvalds
0 siblings, 1 reply; 7+ messages in thread
From: Rik van Riel @ 2001-05-15 15:12 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Daniel Phillips, linux-kernel
On Mon, 14 May 2001, Linus Torvalds wrote:
> > > > + if (PageActive(page))
> > > > + SetPageReferenced(page);
> > > > + else
> > > > + activate_page(page);
> Now, please explain to me why it's not just a simple
>
> SetPageReferenced(page);
>
> and then just moving it lazily from one queue to another..
This might get us into problems when we think we have enough
inactive pages to take the next load spike, but we don't.
On the other hand, that's a theoretical situation and I don't
think we'll hit that in practice ... at least, not in workloads
we'd be able to deal nicely with in any way.
Just going with the simple version should work.
regards,
Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...
http://www.surriel.com/ http://distro.conectiva.com/
Send all your spam to aardvark@nl.linux.org (spam digging piggy)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] filemap.c fixes
2001-05-15 15:12 ` Rik van Riel
@ 2001-05-15 15:37 ` Linus Torvalds
2001-05-15 15:49 ` Rik van Riel
0 siblings, 1 reply; 7+ messages in thread
From: Linus Torvalds @ 2001-05-15 15:37 UTC (permalink / raw)
To: Rik van Riel; +Cc: Daniel Phillips, Marcelo Tosatti, linux-kernel
On Tue, 15 May 2001, Rik van Riel wrote:
>
> > Now, please explain to me why it's not just a simple
> >
> > SetPageReferenced(page);
> >
> > and then just moving it lazily from one queue to another..
> ...
> Just going with the simple version should work.
Can you and Marcelo fight out the changes you've posted and re-do them
against pre2? I've applied some of the most obvious ones, but some had
a thread of "we should really remove xxx/3" etc that didn't seem to get
finished..
Thanks,
Linus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] filemap.c fixes
2001-05-15 15:37 ` Linus Torvalds
@ 2001-05-15 15:49 ` Rik van Riel
0 siblings, 0 replies; 7+ messages in thread
From: Rik van Riel @ 2001-05-15 15:49 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Daniel Phillips, Marcelo Tosatti, linux-kernel
On Tue, 15 May 2001, Linus Torvalds wrote:
> Can you and Marcelo fight out the changes you've posted and re-do them
> against pre2?
OK. Though I don't know when Marcelo and I will be on the same
timezone again (for some reasons his days don't seem to take
24 hours ;)).
> I've applied some of the most obvious ones, but some had a thread of
> "we should really remove xxx/3" etc that didn't seem to get finished..
It should be ok to apply that patch anyway. When we _do_ figure
out which of the two options we should take we'll send you an
incremental patch. Until then we can just leave the "xxx/3" thing
alone.
(in fact, I don't think it'll make much of a difference at all)
regards,
Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...
http://www.surriel.com/ http://distro.conectiva.com/
Send all your spam to aardvark@nl.linux.org (spam digging piggy)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2001-05-15 15:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-14 4:00 [PATCH] filemap.c fixes Rik van Riel
2001-05-14 13:54 ` Daniel Phillips
2001-05-14 14:11 ` Rik van Riel
2001-05-15 6:48 ` Linus Torvalds
2001-05-15 15:12 ` Rik van Riel
2001-05-15 15:37 ` Linus Torvalds
2001-05-15 15:49 ` Rik van Riel
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).