From: Andrea Arcangeli <aarcange@redhat.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: mmu notifier calls in apply_to_page_range()
Date: Fri, 9 Jul 2010 17:12:11 +0200 [thread overview]
Message-ID: <20100709151211.GE13493@random.random> (raw)
In-Reply-To: <4C373AEC.6000502@goop.org>
On Fri, Jul 09, 2010 at 08:06:20AM -0700, Jeremy Fitzhardinge wrote:
> I just noticed that the original mmu notifier change (cddb8a5c14a) adds
> calls to mmu_notifier_invalidate_range_start/end to
> apply_to_page_range(). This doesn't seem correct to me, since
> apply_to_page_range can perform arbitrary operations to the range of
> pages, not just invalidation of the pages. It seems to me that the
> appropriate mmu notifiers should be called either around the call to
> apply_to_page_range(), or from within the callback function.
>
> Andrea, what's the rationale for mmu_notifier_invalidate_range_start/end
> here?
As long as the secondary mappings are teardown in range_start and
allowed to be established again only after range_end, all
modifications will be picked up by the secondary mmu. Imagine
secondary mmu like a tlb, that you only invalidate, then it'll be
refilled later (after range_end).
The exception is set_pte_at_notify that is called by ksm to establish
a readonly secondary pte in KVM, KVM only calls
get_user_pages(write=1) (never write=0 even for reads) so until that
is optimized set_pte_at_notify allows guest to access readonly data
without breaking the cow. set_pte_at_notify invokes a change_pte
method, if not implemented it'll just fallback to the invalidate_page
method that is backwards compatible, so no mmu notifier user is
required to call change_pte (especially if the secondary page fault -
kind of secondary tlb-miss software handler invokes get_user_pages
with write=0 for reads, ->change_pte can only eliminate one minor
fault so no big deal).
next prev parent reply other threads:[~2010-07-09 15:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-09 15:06 mmu notifier calls in apply_to_page_range() Jeremy Fitzhardinge
2010-07-09 15:12 ` Andrea Arcangeli [this message]
2010-07-09 15:51 ` Jeremy Fitzhardinge
2010-07-09 16:22 ` Andrea Arcangeli
2010-07-09 17:30 ` Jeremy Fitzhardinge
2010-07-09 17:36 ` Andrea Arcangeli
2010-07-09 17:41 ` Jeremy Fitzhardinge
2010-07-09 18:31 ` Andrea Arcangeli
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=20100709151211.GE13493@random.random \
--to=aarcange@redhat.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stefano.stabellini@eu.citrix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.