mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Keir Fraser <keir@xensource.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Rientjes <rientjes@google.com>,
	Zachary Amsden <zach@vmware.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Jan Beulich <jbeulich@novell.com>, Andi Kleen <ak@suse.de>,
	Ken Chen <kenchen@google.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: race with page_referenced_one->ptep_test_and_clear_young and pagetable setup/pulldown
Date: Fri, 5 Oct 2007 16:33:16 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0710051601430.14565@blonde.wat.veritas.com> (raw)
In-Reply-To: <C32BBF27.166CA%keir@xensource.com>

On Fri, 5 Oct 2007, Keir Fraser wrote:
> On 5/10/07 10:05, "Jeremy Fitzhardinge" <jeremy@goop.org> wrote:
> > Andi says:
> >> Do I misread that patch or does it really walk the complete address
> >> space and try to take all possible locks? Isn't that very slow?
> > 
> > That's pretty much what it has to do.  Pinning/unpinning walks the whole
> > pagetable anyway, so it shouldn't be much more expensive.  And they're
> > relatively rare operations (fork, exec, exit).
> 
> It is a shame to do 3x walks per pin or unpin, rather than 1x, though.
> 
> One way to improve this, possibly, is to pin the pte tables individually as
> you go, rather than doing one big pin/unpin just at the root pgd. Then you
> can lock/unlock the pte's as you go. I'd suggest that as a possible post
> 2.6.23 improvement, however. Jan's patch has actually had some testing.

A few points come to mind looking at Jan's patch:

The comment about nested pagetable locks is wrong: mm/mremap.c does
nest pagetable locks; but you wouldn't (as I understand it) be doing
this pinning/unpinning anywhere which could race with an mremap() on
the same mm, so that's a niggle about a comment, not a real issue.

Yes, it would be greatly preferable to take the locks one by one
as needed.  As it stands, I think you're in danger of overflowing
the PREEMPT_BITS 8 area of preempt_count(), venturing into the
SOFTIRQ area: I don't know the real-life consequence of that.

I don't see any protection against hugetlb areas, where the pmd
entry may indicate a hugetlb page rather than a pagetable page.
I guess you'll be needing to test pte_huge().  I don't know if
you want to lock those or skip them: locking is usually just
with page_table_lock, but beware there's also sharing of huge
page pmds between mms - Ken Chen should be able to help on that.

If a 2.6.23 fix is needed, I suggest simply excluding split ptlocks
in the Xen case, as shown by the mm/Kconfig - line in Jan's patch.

Hugh

  reply	other threads:[~2007-10-05 15:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <C32B9BEC.E711%keir@xensource.com>
2007-10-05  8:03 ` Andi Kleen
2007-10-05  9:05 ` Jeremy Fitzhardinge
2007-10-05  9:15   ` Keir Fraser
2007-10-05 15:33     ` Hugh Dickins [this message]
2007-10-05 15:46       ` Keir Fraser
2007-10-05 16:48         ` Jeremy Fitzhardinge
2007-10-05 20:35         ` Jeremy Fitzhardinge
2007-10-05  1:43 Jeremy Fitzhardinge
2007-10-05  1:52 ` Rik van Riel
2007-10-05  4:15   ` Jeremy Fitzhardinge
2007-10-05 13:17     ` Rik van Riel
2007-10-05  2:44 ` Andrew Morton
2007-10-05  4:08   ` Jeremy Fitzhardinge
2007-10-07  9:52   ` Nick Piggin
2007-10-05 11:36 ` Hugh Dickins
2007-10-05 18:58   ` Rik van Riel
2007-10-05 19:40     ` Jeremy Fitzhardinge
2007-10-05 19:56       ` Rik van Riel
2007-10-05 19:39   ` Jeremy Fitzhardinge

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.64.0710051601430.14565@blonde.wat.veritas.com \
    --to=hugh@veritas.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=jbeulich@novell.com \
    --cc=jeremy@goop.org \
    --cc=keir@xensource.com \
    --cc=kenchen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@linux-foundation.org \
    --cc=zach@vmware.com \
    /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

Powered by JetHome