mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Phillips <phillips@arcor.de>
To: Andrew Morton <akpm@zip.com.au>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Race in shrink_cache
Date: Thu, 5 Sep 2002 09:28:48 +0200	[thread overview]
Message-ID: <E17mr4K-000660-00@starship> (raw)
In-Reply-To: <3D7702BE.85A5D11D@zip.com.au>

On Thursday 05 September 2002 09:07, Andrew Morton wrote:
> Daniel Phillips wrote:
> > 
> > ...
> > /*
> >  * We must not allow an anon page
> >  * with no buffers to be visible on
> >  * the LRU, so we unlock the page after
> >  * taking the lru lock
> >  */
> > 
> > That is, what's scary about an anon page without buffers?
> 
> ooop.  That's an akpm comment.  umm, err..
> 
> It solves this BUG:
> 
> http://www.cs.helsinki.fi/linux/linux-kernel/2001-37/0594.html
> 
> Around the 2.4.10 timeframe, Andrea started putting anon pages
> on the LRU.  Then he backed that out, then put it in again.  I
> think this comment dates from the time when anon pages were
> not on the LRU.  So there's a little window there where the
> page is unlocked, we've just dropped its swapdev buffers, the page is
> on the LRU and pagemap_lru_lock is not held.
> 
> So another CPU came in, found the page on the LRU, saw that it had
> no ->mapping and no ->buffers and went BUG.
> 
> The fix was to take pagemap_lru_lock before unlocking the page.
> 
> The comment is stale.

With the atomic_dec_and_lock strategy, the page would be freed immediately on 
the buffers being released, and with the lru=1 strategy it doesn't matter 
in terms of correctness whether the page ends up on the lru or not, so I was 
inclined not to worry about this anyway, still, when you a dire-looking 
comment like that...

You said something about your lru locking strategy in 2.5.33-mm2.  I have not
reverse engineered it yet, would you care to wax poetic?

-- 
Daniel

  reply	other threads:[~2002-09-05  7:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-05  5:04 Daniel Phillips
2002-09-05  6:36 ` Andrew Morton
2002-09-05  6:36   ` Daniel Phillips
2002-09-05  7:07     ` Andrew Morton
2002-09-05  7:28       ` Daniel Phillips [this message]
2002-09-05  7:53         ` Andrew Morton
2002-09-05 18:41           ` Daniel Phillips
2002-09-05 18:51             ` Andrew Morton
2002-09-05 19:08               ` Daniel Phillips
2002-09-05 19:22                 ` Andrew Morton
2002-09-05 20:00                   ` Daniel Phillips
2002-09-05 13:33     ` 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=E17mr4K-000660-00@starship \
    --to=phillips@arcor.de \
    --cc=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®