From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
bob.picco@hp.com, iwamoto@valinux.co.jp, christoph@lameter.com,
wfg@mail.ustc.edu.cn, npiggin@suse.de, torvalds@osdl.org,
riel@redhat.com
Subject: Re: [PATCH 00/34] mm: Page Replacement Policy Framework
Date: Thu, 23 Mar 2006 14:53:24 -0600 [thread overview]
Message-ID: <20060323205324.GA11676@dmt.cnet> (raw)
In-Reply-To: <20060322145132.0886f742.akpm@osdl.org>
On Wed, Mar 22, 2006 at 02:51:32PM -0800, Andrew Morton wrote:
> Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> >
> >
> > This patch-set introduces a page replacement policy framework and 4 new
> > experimental policies.
>
> Holy cow.
>
> > The page replacement algorithm determines which pages to swap out.
> > The current algorithm has some problems that are increasingly noticable, even
> > on desktop workloads.
>
> Rather than replacing the whole lot four times I'd really prefer to see
> precise descriptions of these problems, see if we can improve the situation
> incrementally rather than wholesale slash-n-burn...
>
> Once we've done that work to the best of our ability, *then* we're in a
> position to evaluate the performance benefits of this new work. Because
> there's not much point in comparing known-to-have-unaddressed-problems old
> code with fancy new code.
IMHO the page replacement framework intent is wider than fixing the
currently known performance problems.
It allows easier implementation of new algorithms, which are being
invented/adapted over time as necessity appears. At the moment Linux is
stuck with a single policy - and if you think for a moment about the
wide range of scenarios where Linux is being used its easy to conclude
that one policy can't fit all.
It would be great to provide an interface for easier development of
such ideas - keep in mind that page replacement is an area of active
research.
One example (which I mentioned several times) is power saving:
PB-LRU: A Self-Tuning Power Aware Storage Cache Replacement Algorithm
for Conserving Disk Energy.
> 2.6.16-rc6 seems to do OK. I assume the cyclic patterns exploit the lru
> worst case thing? Has consideration been given to tweaking the existing
> code, detect the situation and work avoid the problem?
Use-once fixes the cyclic access pattern case - but at the moment we don't
have use-once for memory mapped pages.
http://marc.theaimsgroup.com/?l=linux-mm&m=113721453502138&w=2
Nick mentions:
"Yes, I found that also doing use-once on mapped pages caused fairly
huge slowdowns in some cases. File IO could much more easily cause X and
its applications to get swapped out."
Anyway, thats not the only problem with LRU, but one of them. The most
fundamental one is the lack of page access frequency book keeping:
http://www.linux-mm.org/PageReplacementTesting
Frequency
The most significant issue with LRU is that it uses too little
information to base the replacement decision: recency alone. It does not
take frequency of page accesses into account.
Here is one example from the LRU-K paper.
"The LRU-K Page-Replacement Algorithm for Database Disk Buffering":
"Consider a multi-user database application, which references randomly
chosen customer records through a clustered B-tree indexed key, CUST-ID,
to retrieve desired information. Assume simplistically that 20,000
customers exist, that a customer reeord is 2000 bytes in length, and
that space needed for the B-tree index at the leaf level, free space
included, is 20 bytes for each key entry. Then if disk pages contain
4000 bytes of usable space and ean be packed full, we require 100 pages
to hold the leaf level nodes of the B-tree index (there is a sin- gle
B-tree root node), and 10,000 pages to hold the reeords. The pattern of
reference to these pages (ignoring the B-tree root node) is clearly:
11, Rl, 12, R2, 13, R3, ... alternate references to random index leaf
pages and record pages. If we can only afford to buffer 101 pages
in memory for this application, the B-tree root node is automatic;
we should buffer all the B-tree leaf pages, since each of them is
referenced with a probability of .005 (once in each 200 general *page*
references), while it is clearly wasteful to displace one of these leaf
pages with a data *page*, since data pages have only .00005 probability
of reference (once in each 20,000 general *page* references). Using the
LRU *algorithm*, however, the pages held in memory buffers will be the
hundred most recently referenced ones. To a first approximation, this
means 50 B-tree leaf pages and 50 record pages. Given that a *page* gets
no extra credit for being referenced twice in the recent past and that
this is more likely to happen with B-tree leaf pages, there will even
be slightly more data pages present in memory than leaf pages. This
is clearly inappropriate behavior for a very common paradigm of disk
accesses."
To me it appears natural that page replacement should be pluggable and
not hard coded in the operating system.
--
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>
next prev parent reply other threads:[~2006-03-23 20:53 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-22 22:31 Peter Zijlstra
2006-03-22 22:31 ` [PATCH 01/34] mm: kill-page-activate.patch Peter Zijlstra
2006-03-22 22:32 ` [PATCH 02/34] mm: page-replace-kconfig-makefile.patch Peter Zijlstra
2006-03-22 23:03 ` Jeff Garzik
2006-03-22 22:32 ` [PATCH 03/34] mm: page-replace-insert.patch Peter Zijlstra
2006-03-22 22:32 ` [PATCH 04/34] mm: page-replace-use_once.patch Peter Zijlstra
2006-03-22 22:32 ` [PATCH 05/34] mm: page-replace-generic-pagevec.patch Peter Zijlstra
2006-03-22 22:32 ` [PATCH 06/34] mm: page-replace-activate.patch Peter Zijlstra
2006-03-22 22:32 ` [PATCH 07/34] mm: page-replace-move-macros.patch Peter Zijlstra
2006-03-22 22:33 ` [PATCH 08/34] mm: page-replace-move-scan_control.patch Peter Zijlstra
2006-03-22 22:33 ` [PATCH 09/34] mm: page-replace-move-isolate_lru_pages.patch Peter Zijlstra
2006-03-22 22:33 ` [PATCH 10/34] mm: page-replace-reinsert.patch Peter Zijlstra
2006-03-22 22:33 ` [PATCH 11/34] mm: page-replace-should_reclaim_mapped.patch Peter Zijlstra
2006-03-22 22:33 ` [PATCH 12/34] mm: page-replace-shrink.patch Peter Zijlstra
2006-03-22 22:33 ` [PATCH 13/34] mm: page-replace-mark-accessed.patch Peter Zijlstra
2006-03-22 22:34 ` [PATCH 14/34] mm: page-replace-remove-mm_inline.patch Peter Zijlstra
2006-03-22 22:34 ` [PATCH 15/34] mm: page-replace-rotate.patch Peter Zijlstra
2006-03-22 22:34 ` [PATCH 16/34] mm: page-replace-init.patch Peter Zijlstra
2006-03-22 22:34 ` [PATCH 17/34] mm: page-replace-info.patch Peter Zijlstra
2006-03-22 22:34 ` [PATCH 18/34] mm: page-replace-counts.patch Peter Zijlstra
2006-03-22 22:34 ` [PATCH 19/34] mm: page-replace-data.patch Peter Zijlstra
2006-03-22 22:35 ` [PATCH 20/34] mm: page-replace-pg_flags.patch Peter Zijlstra
2006-03-22 22:35 ` [PATCH 21/34] mm: page-replace-nonresident.patch Peter Zijlstra
2006-03-22 22:35 ` [PATCH 22/34] mm: page-replace-shrink-new.patch Peter Zijlstra
2006-03-22 22:35 ` [PATCH 23/34] mm: page-replace-documentation.patch Peter Zijlstra
2006-03-22 22:35 ` [PATCH 24/34] mm: sum_cpu_var.patch Peter Zijlstra
2006-03-22 22:35 ` [PATCH 25/34] mm: kswapd-writeout-wait.patch Peter Zijlstra
2006-03-22 22:36 ` [PATCH 26/34] mm: clockpro-nonresident.patch Peter Zijlstra
2006-03-22 22:36 ` [PATCH 27/34] mm: clockpro-ignore_token.patch Peter Zijlstra
2006-03-22 22:36 ` [PATCH 28/34] mm: clockpro-PG_reclaim2.patch Peter Zijlstra
2006-03-22 22:36 ` [PATCH 29/34] mm: clockpro-clockpro.patch Peter Zijlstra
2006-03-22 22:36 ` [PATCH 30/34] mm: cart-nonresident.patch Peter Zijlstra
2006-03-22 22:36 ` [PATCH 31/34] mm: cart-PG_reclaim3.patch Peter Zijlstra
2006-03-22 22:37 ` [PATCH 32/34] mm: cart-cart.patch Peter Zijlstra
2006-03-22 22:37 ` [PATCH 33/34] mm: cart-r.patch Peter Zijlstra
2006-03-22 22:37 ` [PATCH 34/34] mm: random.patch Peter Zijlstra
2006-03-22 22:51 ` [PATCH 00/34] mm: Page Replacement Policy Framework Andrew Morton
2006-03-23 2:21 ` Nick Piggin
2006-03-23 21:13 ` Marcelo Tosatti
2006-03-23 4:01 ` Rik van Riel
2006-03-23 20:53 ` Marcelo Tosatti [this message]
2006-03-23 18:15 ` Linus Torvalds
2006-03-23 18:26 ` Rik van Riel
2006-03-23 18:48 ` Diego Calleja
2006-03-23 19:03 ` Peter Zijlstra
2006-03-23 22:30 ` Marcelo Tosatti
2006-03-23 20:49 ` Linus Torvalds
2006-03-23 20:59 ` Rik van Riel
2006-03-24 15:06 ` Helge Hafting
2006-03-28 23:05 ` Elladan
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=20060323205324.GA11676@dmt.cnet \
--to=marcelo.tosatti@cyclades.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@osdl.org \
--cc=bob.picco@hp.com \
--cc=christoph@lameter.com \
--cc=iwamoto@valinux.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=npiggin@suse.de \
--cc=riel@redhat.com \
--cc=torvalds@osdl.org \
--cc=wfg@mail.ustc.edu.cn \
/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