linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Phillips <phillips@arcor.de>
To: Rik van Riel <riel@conectiva.com.br>, Andrew Morton <akpm@digeo.com>
Cc: William Lee Irwin III <wli@holomorphy.com>,
	sfkaplan@cs.amherst.edu, linux-mm@kvack.org
Subject: Re: [PATCH] modified segq for 2.5
Date: Tue, 10 Sep 2002 02:17:20 +0200	[thread overview]
Message-ID: <E17oYiW-0006w5-00@starship> (raw)
In-Reply-To: <Pine.LNX.4.44L.0209091938500.1857-100000@imladris.surriel.com>

On Tuesday 10 September 2002 00:41, Rik van Riel wrote:
> On Mon, 9 Sep 2002, Andrew Morton wrote:
> > Do we remove the SetPageReferenced() in generic_file_write?
> 
> Good question, I think we'll want to SetPageReferenced() when
> we do a partial write but ClearPageReferenced() when we've
> "written past the end" of the page.

There's no substitute for the real thing: a short delay queue where we treat 
all references as a single reference.  In generic_file_write, a page goes 
onto this list immediately on instantiation.  On exit from the delay queue we 
unconditionally clear the referenced bit and use the rmap list to discard the 
pte referenced bits, then move the page to the inactive list.

>From there, a second reference will rescue the page to the hot end of the 
active list.  Faulted-in pages, including swapped-in pages, mmaped pages and 
zeroed anon pages, take the same path as file IO pages.

A reminder of why we're going to all this effort in the first place: it's to 
distinguish automatically between streaming IO and repeated use of data.  
With the improvements described here, we will additionally be able to detect 
used-once anon pages, which would include execute-once.

Because of readahead, generic_file_read has to work a little differently.  
Ideally, we'd have a time-ordered readahead list and when the readahead 
heuristics accidently get too aggressive, we can cannibalize the future end 
of the list (and pour some cold water on the readahead thingy).  A crude 
approximation of that behavior is just to have a readahead FIFO, and an even 
cruder approximation is to use the inactive list for this purpose.  
Unfortunately, the latter is too crude, because not-yet-used-readahead pages 
have to have a higher priority than just-used pages, otherwise the former 
will be recovered before the latter, which is not what we want.

In any event, each page that passes under the read head of generic_file_read 
goes to the hot end of the delay queue, and from there behaves just like 
other kinds of pages.

Attention has to be paid to balancing the aggressiveness of readahead against 
the refill_inactive scanning rate.  These move in opposite directions in 
response to memory pressure.

One could argue that program text is inherently more valuable than allocated 
data or file cache, in which case it may want its own inactive list, so that 
we can reclaim program text vs other kinds of data at different rates.  The 
relative rates could depend on the relative instantiation rates (which 
includes the faulting rate and the file IO cache page creation rate).  
However, I'd like to see how well the crude presumption of equality works, 
and besides, it's less work that way.  (So ignore this paragraph, please.)

As far as zones go, the route of least resistance is to make both the delay 
queue and the readahead list per-zone, and since that means it's also 
per-node, numa people should like it.

On the testing front, one useful cross-check is to determine whether hot 
spots in code are correctly detected.  After running a while under mixed 
program activity and file IO, we should see that the hot spots as determined 
by a profiler (or cooked by a test program) have in fact moved to the active 
list, while initialization code has been evicted.

All of the above is O(1).

-- 
Daniel
--
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/

  reply	other threads:[~2002-09-10  0:17 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-15 14:24 Rik van Riel
2002-09-09  9:38 ` Andrew Morton
2002-09-09 11:40   ` Ed Tomlinson
2002-09-09 17:10     ` William Lee Irwin III
2002-09-09 18:58     ` Andrew Morton
2002-09-09 13:10   ` Rik van Riel
2002-09-09 19:03     ` Andrew Morton
2002-09-09 19:25       ` Rik van Riel
2002-09-09 19:55         ` Andrew Morton
2002-09-09 20:03           ` Rik van Riel
2002-09-09 20:51         ` Andrew Morton
2002-09-09 20:57           ` Andrew Morton
2002-09-09 21:09           ` Rik van Riel
2002-09-09 21:52             ` Andrew Morton
2002-09-09 22:41               ` Rik van Riel
2002-09-10  0:17                 ` Daniel Phillips [this message]
2002-09-09 22:49           ` William Lee Irwin III
2002-09-09 22:54             ` Rik van Riel
2002-09-09 23:32               ` William Lee Irwin III
2002-09-09 23:53                 ` Rik van Riel
2002-09-09 22:46   ` Daniel Phillips
2002-09-09 22:58     ` Andrew Morton
2002-09-09 23:40       ` William Lee Irwin III
2002-09-10  0:02         ` Andrew Morton
2002-09-10  0:21           ` William Lee Irwin III
2002-09-10  1:13             ` Andrew Morton
2002-09-10  1:50       ` Daniel Phillips
2002-09-10  2:02         ` Rik van Riel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E17oYiW-0006w5-00@starship \
    --to=phillips@arcor.de \
    --cc=akpm@digeo.com \
    --cc=linux-mm@kvack.org \
    --cc=riel@conectiva.com.br \
    --cc=sfkaplan@cs.amherst.edu \
    --cc=wli@holomorphy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox