public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Niki Hammler <mailinglists@nobaq.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Why active list and inactive list?
Date: Tue, 23 Jan 2007 01:39:39 +0100	[thread overview]
Message-ID: <20070123003939.GY13798@opteron.random> (raw)
In-Reply-To: <45B55286.5060909@nobaq.net>

On Tue, Jan 23, 2007 at 01:10:46AM +0100, Niki Hammler wrote:
> Dear Linux Developers/Enthusiasts,
> 
> For a course at my university I'm implementing parts of an operating
> system where I get most ideas from the Linux Kernel (which I like very
> much). One book I gain information from is [1].
> 
> Linux uses for its Page Replacing Algorithm (based on LRU) *two* chained
> lists - one active list and one active list.
> I implemented my PRA this way too.
> 
> No the big question is: WHY do I need *two* lists? Isn't it just
> overhead/more work? Are there any reasons for that?
>
> In my opinion, it would be better to have just one just; pop frames to
> be swapped out from the end of the list and push new frames in front of
> it. Then just evaluate the frames and shift them around in the list.
> 
> Is there any explanation why Linux uses two lists?

Back then I designed it with two lru lists because by splitting the
active from the inactive cache allows to detect the cache pollution
before it starts discarding the working set. The idea is that the
pollution will enter and exit the inactive list without ever being
elected to the active list because by definition it will never
generate a cache hit. The working set will instead trigger cache hits
during page faults or repeated reads, and it will be preserved better
by electing it to enter the active list.

A page in the inactive list will be collected much more quickly than a
page in the active list, so the pollution will be collected more
quickly than the working set. Then the VM while freeing cache tries to
keep a balance between the size of the two lists to avoid being too
unfair, obviously at some point the active list have to be
de-activated too. If your server "fits in ram" you'll find lots of
cache to be active and so the I/O activity not part of the working set
will be collected without affecting the working set much.

  reply	other threads:[~2007-01-23  0:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-23  0:10 Why active list and inactive list? Niki Hammler
2007-01-23  0:39 ` Andrea Arcangeli [this message]
2007-01-23  1:31   ` Balbir Singh
2007-01-23  1:40     ` Christoph Lameter
2007-01-23  1:49       ` Rik van Riel
2007-01-23  2:03         ` Christoph Lameter
2007-01-23  2:17           ` Rik van Riel
2007-01-23  2:44             ` Christoph Lameter
2007-01-23  2:50               ` Rik van Riel
2007-01-23  8:29           ` Peter Zijlstra
2007-01-23 15:02             ` Rik van Riel
2007-01-30 11:01               ` Howard Chu
2007-01-23  3:36         ` Balbir Singh
2007-01-23  3:43           ` Christoph Lameter
2007-01-23  3:51             ` Balbir Singh
2007-01-23  3:18       ` Balbir Singh
2007-01-23  3:28         ` Christoph Lameter
2007-01-23  3:45           ` Balbir Singh
2007-01-23  3:51             ` Christoph Lameter
2007-01-23  1:42     ` Rik van Riel
2007-01-23  2:13     ` Andrea Arcangeli
2007-01-23  4:17     ` Nick Piggin
2007-01-23  4:34       ` Rik van Riel
2007-01-23  5:51         ` Balbir Singh
2007-01-23  4:46       ` Balbir Singh
     [not found] <7Gpmk-5fN-21@gated-at.bofh.it>
2007-01-30 10:23 ` Howard Chu

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=20070123003939.GY13798@opteron.random \
    --to=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailinglists@nobaq.net \
    /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