From: Hugh Dickins <hugh@veritas.com>
To: Christoph Lameter <clameter@sgi.com>
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: Re: Race in pagevec_strip?
Date: Thu, 16 Mar 2006 19:44:25 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.61.0603161934220.24837@goblin.wat.veritas.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0603161056270.2518@schroedinger.engr.sgi.com>
On Thu, 16 Mar 2006, Christoph Lameter wrote:
> Sigh. TestSetPackLocked works just opposite of spin_trylock. So add an !
>
>
> Seems that we can call try_to_release_page with PagePrivate off and a
> valid mapping? This may cause all sorts of trouble for the
> filesystem *_releasepage() handlers. XFS bombs out in that case.
I think you're right, and you are consistent with the sequence when
try_to_release_page is called from elsewhere.
But the last time I had anything to do with try_to_release_page was
way back in 2.5.mid, I don't think there was a pagevec_strip then.
Andrew will know better.
I can't see what protects the default drop_buffers case against this,
so can't argue that it's an XFS problem.
But wouldn't you, on balance, be better off repeating the
PagePrivate test within the lock?
if (PagePrivate(page) && !TestSetPageLocked(page)) {
if (PagePrivate(page))
try_to_release_page(page, 0);
unlock_page(page);
}
>
> Lock the page before checking for page private.
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> Index: linux-2.6.16-rc6/mm/swap.c
> ===================================================================
> --- linux-2.6.16-rc6.orig/mm/swap.c 2006-03-11 14:12:55.000000000 -0800
> +++ linux-2.6.16-rc6/mm/swap.c 2006-03-16 10:15:23.000000000 -0800
> @@ -392,8 +392,9 @@ void pagevec_strip(struct pagevec *pvec)
> for (i = 0; i < pagevec_count(pvec); i++) {
> struct page *page = pvec->pages[i];
>
> - if (PagePrivate(page) && !TestSetPageLocked(page)) {
> - try_to_release_page(page, 0);
> + if (!TestSetPageLocked(page)) {
> + if (PagePrivate(page))
> + try_to_release_page(page, 0);
> unlock_page(page);
> }
> }
next prev parent reply other threads:[~2006-03-16 19:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-16 18:36 Christoph Lameter
2006-03-16 18:57 ` Christoph Lameter
2006-03-16 19:44 ` Hugh Dickins [this message]
2006-03-16 19:49 ` Christoph Lameter
2006-03-16 20:02 ` Hugh Dickins
2006-03-17 0:50 ` Christoph Lameter
2006-03-17 18:05 ` Hugh Dickins
2006-03-17 18:11 ` Christoph Lameter
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=Pine.LNX.4.61.0603161934220.24837@goblin.wat.veritas.com \
--to=hugh@veritas.com \
--cc=akpm@osdl.org \
--cc=clameter@sgi.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
all inboxes | Powered by JetHome®