LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@qumranet.com> To: Brice Goglin <Brice.Goglin@inria.fr> Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] mmu notifiers #v2 Date: Wed, 16 Jan 2008 11:19:40 +0100 [thread overview] Message-ID: <20080116101939.GH7059@v2.random> (raw) In-Reply-To: <478DC7EC.1040101@inria.fr> On Wed, Jan 16, 2008 at 10:01:32AM +0100, Brice Goglin wrote: > One of the difference with my patch is that you attach the notifier list to > the mm_struct while my code attached it to vmas. But I now don't think it > was such a good idea since it probably didn't reduce the number of notifier > calls a lot. Thanks for raising this topic. Notably KVM also would be a bit more optimal with the notifier in the vma and that was the original implementation too. It's not a sure thing that it has to be in the mm. The quadrics patch does a mixture, it attaches it to the mm but then it pretends to pass the vma down to the method, and it's broken doing so, like during munmap where it passes the first vma being unmapped but not all the later ones in the munmap range. If we want to attach it to the vma, I think the vma should be passed as parameter instead of the mm. In some places like apply_to_page_range the vma isn't even available and I found a little dirty to run a find_vma inside a #ifdef CONFIG_MMU_NOTIFIER. The only thing the vma could be interesting about are the protection bits for things like update_range in the quadrics patch where they prefetch their secondary tlb. But again if we want to do that, we need to hook inside unmap_vmas and to pass all the different vmas and not just the first one touched by unmap_vmas. unmap_vmas is _plural_ not singular ;). In the end attaching to mm avoided solving all the above troubles and provided a strightforward implementation where I would need a single call to mmu_notifier_register and other minor advantages like that and not much downside. But certainly the mm vs vma decision wasn't trivial (I switched back and forth a few times from vma to mm and back) and if people thinks this shall be in the vma I can try again but it won't be as a strightforward patch as for the mm. One benefit is for example is that it could go in the memslot and effectively the notifier->memslot conversion would be just a containerof instead of a "search" over the memslots. Locking aside. > Also, one thing that I looked at in vmaspy was notifying fork. I am not > sure what happens on Copy-on-write with your code, but for sure C-o-w is > problematic for shadow page tables. I thought shadow pages should just be > invalidated when a fork happens and the caller would refill them after > forcing C-o-w or so. So adding a notifier call there too might be nice. There can't be any cows right now in KVM VM backing store, that's why it's enough to get full swapping working fine. For example I think we'll need to add more notifiers to handle swapping of MAP_PRIVATE non linear tmpfs shared pages properly (and it won't be an issue with fork() but with after the fact sharing). Right now I'm more interested in the interface, for the invalidates, things like mm vs vma, the places where we hook under pte spinlock, things like that, then the patch can hopefully be merged and extended with more methods like ->change_protection_page/range and added to cow etc...
next prev parent reply other threads:[~2008-01-16 10:19 UTC|newest] Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-01-13 16:24 [PATCH] mmu notifiers #v2 Andrea Arcangeli 2008-01-13 21:11 ` Benjamin Herrenschmidt 2008-01-14 20:02 ` Christoph Lameter 2008-01-15 4:28 ` Benjamin Herrenschmidt 2008-01-15 12:44 ` Andrea Arcangeli 2008-01-15 20:18 ` Benjamin Herrenschmidt 2008-01-16 1:06 ` Andrea Arcangeli 2008-01-16 9:01 ` Brice Goglin 2008-01-16 10:19 ` Andrea Arcangeli [this message] 2008-01-16 17:42 ` Rik van Riel 2008-01-16 17:48 ` Izik Eidus 2008-01-17 16:23 ` Andrea Arcangeli 2008-01-17 18:21 ` Izik Eidus 2008-01-17 19:32 ` Andrea Arcangeli 2008-01-21 12:52 ` [PATCH] mmu notifiers #v3 Andrea Arcangeli 2008-01-22 2:21 ` Rik van Riel 2008-01-22 14:12 ` [kvm-devel] " Avi Kivity 2008-01-22 14:43 ` Andrea Arcangeli 2008-01-22 20:08 ` [kvm-devel] [PATCH] mmu notifiers #v4 Andrea Arcangeli 2008-01-22 20:34 ` [kvm-devel] [PATCH] export notifier #1 Christoph Lameter 2008-01-22 22:31 ` Andrea Arcangeli 2008-01-22 22:53 ` Christoph Lameter 2008-01-23 10:27 ` Avi Kivity 2008-01-23 10:52 ` Robin Holt 2008-01-23 12:04 ` Andrea Arcangeli 2008-01-23 12:34 ` Robin Holt 2008-01-23 19:48 ` Christoph Lameter 2008-01-23 19:58 ` Robin Holt 2008-01-23 19:47 ` Christoph Lameter 2008-01-24 5:56 ` Avi Kivity 2008-01-24 12:26 ` Andrea Arcangeli 2008-01-24 12:34 ` Avi Kivity 2008-01-23 11:41 ` Andrea Arcangeli 2008-01-23 12:32 ` Robin Holt 2008-01-23 17:33 ` Andrea Arcangeli 2008-01-23 20:27 ` Christoph Lameter 2008-01-24 15:42 ` Andrea Arcangeli 2008-01-24 20:07 ` Christoph Lameter 2008-01-25 6:35 ` Avi Kivity 2008-01-23 20:18 ` Christoph Lameter 2008-01-24 14:34 ` Andrea Arcangeli 2008-01-24 14:41 ` Andrea Arcangeli 2008-01-24 15:15 ` Avi Kivity 2008-01-24 15:18 ` Avi Kivity 2008-01-24 20:01 ` Christoph Lameter 2008-01-22 23:36 ` Benjamin Herrenschmidt 2008-01-23 0:40 ` Christoph Lameter 2008-01-23 1:21 ` Robin Holt 2008-01-23 12:51 ` Gerd Hoffmann 2008-01-23 13:19 ` Robin Holt 2008-01-23 14:12 ` Gerd Hoffmann 2008-01-23 14:18 ` Robin Holt 2008-01-23 14:35 ` Gerd Hoffmann 2008-01-23 15:48 ` Robin Holt 2008-01-23 14:17 ` Avi Kivity 2008-01-24 4:03 ` Benjamin Herrenschmidt 2008-01-23 15:41 ` Andrea Arcangeli 2008-01-23 17:47 ` Gerd Hoffmann 2008-01-24 6:01 ` Avi Kivity 2008-01-24 6:45 ` Jeremy Fitzhardinge 2008-01-23 20:40 ` Christoph Lameter 2008-01-24 2:00 ` Enhance mmu notifiers to accomplish a lockless implementation (incomplete) Robin Holt 2008-01-24 4:05 ` Robin Holt 2008-01-22 19:28 ` [PATCH] mmu notifiers #v3 Peter Zijlstra 2008-01-22 20:31 ` Christoph Lameter 2008-01-22 20:31 ` Andrea Arcangeli 2008-01-22 22:10 ` 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=20080116101939.GH7059@v2.random \ --to=andrea@qumranet.com \ --cc=Brice.Goglin@inria.fr \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.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: linkBe 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; as well as URLs for NNTP newsgroup(s).