LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: Andrea Arcangeli <andrea@qumranet.com>
Cc: Nick Piggin <npiggin@suse.de>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
linux-mm@kvack.org,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Jack Steiner <steiner@sgi.com>,
linux-kernel@vger.kernel.org, Avi Kivity <avi@qumranet.com>,
kvm-devel@lists.sourceforge.net, daniel.blueman@quadrics.com,
Robin Holt <holt@sgi.com>, Hugh Dickins <hugh@veritas.com>
Subject: Re: [kvm-devel] [patch 1/6] mmu_notifier: Core code
Date: Wed, 30 Jan 2008 17:27:37 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0801301718530.2454@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20080131001258.GD7185@v2.random>
On Thu, 31 Jan 2008, Andrea Arcangeli wrote:
> > Hmmmm.. exit_mmap is only called when the last reference is removed
> > against the mm right? So no tasks are running anymore. No pages are left.
> > Do we need to serialize at all for mmu_notifier_release?
>
> KVM sure doesn't need any locking there. I thought somebody had to
> possibly take a pin on the "mm_count" and pretend to call
> mmu_notifier_register at will until mmdrop was finally called, in a
> out of order fashion given mmu_notifier_release was implemented like
> if the list could change from under it. Note mmdrop != mmput. mmput
> and in turn mm_users is the serialization point if you prefer to drop
> all locking from _release. Nobody must ever attempt a mmu_notifier_*
> after calling mmput for that mm. That should be enough to be
> safe. I'm fine either ways...
exit_mmap (where we call invalidate_all() and release()) is called when
mm_users == 0:
void mmput(struct mm_struct *mm)
{
might_sleep();
if (atomic_dec_and_test(&mm->mm_users)) {
exit_aio(mm);
exit_mmap(mm);
if (!list_empty(&mm->mmlist)) {
spin_lock(&mmlist_lock);
list_del(&mm->mmlist);
spin_unlock(&mmlist_lock);
}
put_swap_token(mm);
mmdrop(mm);
}
}
EXPORT_SYMBOL_GPL(mmput);
So there is only a single thread executing at the time when
invalidate_all() is called from exit_mmap(). Then we drop the
pages, and the page tables. After the page tables we call the ->release
method and then remove the vmas.
So even dropping off the mmu_notifier chain in invalidate_all() could be
done without an issue and without locking.
Trouble is if other callbacks attempt the same. Do we need to support the
removal from the mmu_notifier list in invalidate_range()?
next prev parent reply other threads:[~2008-01-31 1:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-30 2:29 [patch 0/6] [RFC] MMU Notifiers V3 Christoph Lameter
2008-01-30 2:29 ` [patch 1/6] mmu_notifier: Core code Christoph Lameter
2008-01-30 15:37 ` Andrea Arcangeli
2008-01-30 15:53 ` Jack Steiner
2008-01-30 16:38 ` Andrea Arcangeli
2008-01-30 19:19 ` Christoph Lameter
2008-01-30 22:20 ` Robin Holt
2008-01-30 23:38 ` Andrea Arcangeli
2008-01-30 23:55 ` Christoph Lameter
2008-01-31 0:12 ` [kvm-devel] " Andrea Arcangeli
2008-01-31 1:27 ` Christoph Lameter [this message]
2008-01-30 17:10 ` Peter Zijlstra
2008-01-30 19:28 ` Christoph Lameter
2008-01-30 18:02 ` Robin Holt
2008-01-30 19:08 ` Christoph Lameter
2008-01-30 19:14 ` Christoph Lameter
2008-01-30 2:29 ` [patch 2/6] mmu_notifier: Callbacks to invalidate address ranges Christoph Lameter
2008-01-30 2:29 ` [patch 3/6] mmu_notifier: invalidate_page callbacks for subsystems with rmap Christoph Lameter
2008-01-30 18:03 ` Robin Holt
2008-01-30 2:29 ` [patch 4/6] MMU notifier: invalidate_page callbacks using Linux rmaps Christoph Lameter
2008-01-30 2:29 ` [patch 5/6] mmu_notifier: Callbacks for xip_filemap.c Christoph Lameter
2008-01-30 2:29 ` [patch 6/6] mmu_notifier: Add invalidate_all() 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.64.0801301718530.2454@schroedinger.engr.sgi.com \
--to=clameter@sgi.com \
--cc=a.p.zijlstra@chello.nl \
--cc=andrea@qumranet.com \
--cc=avi@qumranet.com \
--cc=benh@kernel.crashing.org \
--cc=daniel.blueman@quadrics.com \
--cc=holt@sgi.com \
--cc=hugh@veritas.com \
--cc=kvm-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=npiggin@suse.de \
--cc=steiner@sgi.com \
--subject='Re: [kvm-devel] [patch 1/6] mmu_notifier: Core code' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).