The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: Hugh Dickins <hugh@veritas.com>,
	j-nomura@ce.jp.nec.com, linux-kernel@vger.kernel.org
Subject: Re: 2.4.18(19) swapcache oops
Date: Thu, 15 Aug 2002 13:21:17 -0700	[thread overview]
Message-ID: <3D5C0D3D.E68137BA@zip.com.au> (raw)
In-Reply-To: 3D5C0995.CEE36FC8@zip.com.au

Andrew Morton wrote:
> 
> ...
> --- 2.4.19/mm/swap.c~lru-race   Thu Aug 15 13:03:48 2002
> +++ 2.4.19-akpm/mm/swap.c       Thu Aug 15 13:04:19 2002
> @@ -57,9 +57,10 @@ void activate_page(struct page * page)
>   */
>  void lru_cache_add(struct page * page)
>  {
> -       if (!TestSetPageLRU(page)) {
> +       if (!PageLRU(page)) {
>                 spin_lock(&pagemap_lru_lock);
> -               add_page_to_inactive_list(page);
> +               if (!TestSetPageLRU(page))
> +                       add_page_to_inactive_list(page);
>                 spin_unlock(&pagemap_lru_lock);
>         }
>  }

Seems that I fixed this in 2.5.32.  That set_bit outside
the lock gave me the willes, and I couldn't put my finger on why.
Never occurred to me that the page could be found via pagecache
lookup in this manner.

In 2.5, it is effectively:

void lru_cache_add(struct page * page)
{
        spin_lock(&pagemap_lru_lock);
        if (TestSetPageLRU(page))
                BUG();
        add_page_to_inactive_list(page);
        spin_unlock(&pagemap_lru_lock);
}

which is what should be tested in 2.4.  It's stricter, and significantly
faster.

  reply	other threads:[~2002-08-15 20:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-15 12:39 2.4.18(19) swapcache oops j-nomura
2002-08-15 14:32 ` Hugh Dickins
2002-08-15 20:05   ` Andrew Morton
2002-08-15 20:21     ` Andrew Morton [this message]
2002-08-16  4:19       ` j-nomura
2002-08-16  4:40         ` Andrew Morton
2002-08-16  8:07           ` j-nomura
2002-08-15 22:59     ` Hugh Dickins

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=3D5C0D3D.E68137BA@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=hugh@veritas.com \
    --cc=j-nomura@ce.jp.nec.com \
    --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