linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Zhao Forrest <forrest.zhao@gmail.com>
Cc: riel@redhat.com, linux-mm@kvack.org
Subject: Re: A question about page aging in page frame reclaimation
Date: Wed, 04 Apr 2007 12:50:29 +0200	[thread overview]
Message-ID: <1175683829.6483.57.camel@twins> (raw)
In-Reply-To: <ac8af0be0704040333k25459a8cwec6729e8ad6a4db4@mail.gmail.com>

On Wed, 2007-04-04 at 18:33 +0800, Zhao Forrest wrote:
> Hi Riel,
> 
> I'm studying the code of page frame reclaimation in 2.6 kernel. From
> my understanding, there should be kernel thread periodically scanning
> the active and inactive list and move the page frames between active
> and inactive list according to LRU rule.
> 
> But I can't find the related code.....would you please point me to the
> code piece that implement this "page aging" functionality?
> Sorry for the stupid question, but I think I don't have a very strong
> code-reading ability.

There is no time related scanning; we only scan when we wake up kswapd
or in direct reclaim. 

We wake kswapd when the free page count drops below the high watermark.
(look for callers of wakeup_kswapd()).

Direct reclaim is a per task reclaim, entered when the free page count
drops below the low watermark, this provides per task feedback when
under heavy pressure.

So reclaim is driven purely by page allocation.

The active -> inactive shuffling is a tad involved. But basically: we
scan the active list proportionally to its size to move active pages to
the inactive list, then scan the inactive list (proportional to its size
before the active->inactive move).

Pages on the inactive list that are referenced are moved to the active
list. Unreferenced pages in the active list are moved to the inactive
list. (Checking the reference bit also clears it).

And a gazillion exceptions and details...

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

  reply	other threads:[~2007-04-04 10:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-04 10:33 Zhao Forrest
2007-04-04 10:50 ` Peter Zijlstra [this message]
2007-04-05  4:03 ` 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=1175683829.6483.57.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=forrest.zhao@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.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