From: Peter Feiner <pfeiner@google.com>
To: Hugh Dickins <hughd@google.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
"Kirill A. Shutemov" <kirill@shutemov.name>,
Cyrill Gorcunov <gorcunov@openvz.org>,
Pavel Emelyanov <xemul@parallels.com>,
Jamie Liu <jamieliu@google.com>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
Andrew Morton <akpm@linux-foundation.org>,
Magnus Damm <magnus.damm@gmail.com>
Subject: Re: [PATCH v5] mm: softdirty: enable write notifications on VMAs after VM_SOFTDIRTY cleared
Date: Sun, 7 Sep 2014 14:31:17 -0700 [thread overview]
Message-ID: <20140907213117.GA388@google.com> (raw)
In-Reply-To: <20140904164311.GA29610@google.com>
On Thu, Sep 04, 2014 at 09:43:11AM -0700, Peter Feiner wrote:
> On Mon, Aug 25, 2014 at 09:45:34PM -0700, Hugh Dickins wrote:
> > That sets me wondering: have you placed the VM_SOFTDIRTY check in the
> > right place in this series of tests?
> >
> > I think, once pgprot_modify() is correct on all architectures,
> > it should be possible to drop that pgprot_val() check from
> > vma_wants_writenotify() - which would be a welcome simplification.
> >
> > But what about the VM_PFNMAP test below it? If that test was necessary,
> > then having your VM_SOFTDIRTY check before it seems dangerous. But I'm
> > hoping we can persuade ourselves that the VM_PFNMAP test was unnecessary,
> > and simply delete it.
>
> If VM_PFNMAP is necessary, then I definitely put the VM_SOFTDIRTY check in the
> wrong spot :-) I don't know much (i.e., anything) about VM_PFNMAP, so I'll
> have to bone up on a lot of code before I have an informed opinion about the
> necessity of the check.
AFAICT, the VM_PFNMAP check is unnecessary since I can't find any drivers that
set VM_PFNMAP and enable dirty accounting on their mappings. If anything,
VM_PFNMAP precludes mapping dirty tracking since set_page_dirty takes a
struct_page argument! Perhaps the VM_PFNMAP check was originally put in
vma_wants_writenotify as a safeguard against bogus calls to set_page_dirty?
In any case, it seems harmless to me to put the VM_SOFTDIRTY check before the
VM_PFNMAP check since none of the fault handling code in mm/memory.c calls
set_page_dirty on a VM_PFNMAP fault because either vm_normal_page() returns
NULL or ->fault() / ->page_mkwrite() return VM_FAULT_NOPAGE. Moreover, for
the purpose of softdirty tracking, enabling write notifications on VM_PFNMAP
VMAs is OK since do_wp_page does the right thing when vm_normal_page() returns
NULL.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Peter Feiner <pfeiner@google.com>
To: Hugh Dickins <hughd@google.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
"Kirill A. Shutemov" <kirill@shutemov.name>,
Cyrill Gorcunov <gorcunov@openvz.org>,
Pavel Emelyanov <xemul@parallels.com>,
Jamie Liu <jamieliu@google.com>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
Andrew Morton <akpm@linux-foundation.org>,
Magnus Damm <magnus.damm@gmail.com>
Subject: Re: [PATCH v5] mm: softdirty: enable write notifications on VMAs after VM_SOFTDIRTY cleared
Date: Sun, 7 Sep 2014 14:31:17 -0700 [thread overview]
Message-ID: <20140907213117.GA388@google.com> (raw)
In-Reply-To: <20140904164311.GA29610@google.com>
On Thu, Sep 04, 2014 at 09:43:11AM -0700, Peter Feiner wrote:
> On Mon, Aug 25, 2014 at 09:45:34PM -0700, Hugh Dickins wrote:
> > That sets me wondering: have you placed the VM_SOFTDIRTY check in the
> > right place in this series of tests?
> >
> > I think, once pgprot_modify() is correct on all architectures,
> > it should be possible to drop that pgprot_val() check from
> > vma_wants_writenotify() - which would be a welcome simplification.
> >
> > But what about the VM_PFNMAP test below it? If that test was necessary,
> > then having your VM_SOFTDIRTY check before it seems dangerous. But I'm
> > hoping we can persuade ourselves that the VM_PFNMAP test was unnecessary,
> > and simply delete it.
>
> If VM_PFNMAP is necessary, then I definitely put the VM_SOFTDIRTY check in the
> wrong spot :-) I don't know much (i.e., anything) about VM_PFNMAP, so I'll
> have to bone up on a lot of code before I have an informed opinion about the
> necessity of the check.
AFAICT, the VM_PFNMAP check is unnecessary since I can't find any drivers that
set VM_PFNMAP and enable dirty accounting on their mappings. If anything,
VM_PFNMAP precludes mapping dirty tracking since set_page_dirty takes a
struct_page argument! Perhaps the VM_PFNMAP check was originally put in
vma_wants_writenotify as a safeguard against bogus calls to set_page_dirty?
In any case, it seems harmless to me to put the VM_SOFTDIRTY check before the
VM_PFNMAP check since none of the fault handling code in mm/memory.c calls
set_page_dirty on a VM_PFNMAP fault because either vm_normal_page() returns
NULL or ->fault() / ->page_mkwrite() return VM_FAULT_NOPAGE. Moreover, for
the purpose of softdirty tracking, enabling write notifications on VM_PFNMAP
VMAs is OK since do_wp_page does the right thing when vm_normal_page() returns
NULL.
next prev parent reply other threads:[~2014-09-07 21:31 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-20 21:46 [PATCH] mm: softdirty: write protect PTEs created for read faults after VM_SOFTDIRTY cleared Peter Feiner
2014-08-20 21:46 ` Peter Feiner
2014-08-20 23:45 ` Kirill A. Shutemov
2014-08-20 23:45 ` Kirill A. Shutemov
2014-08-21 19:37 ` Peter Feiner
2014-08-21 19:37 ` Peter Feiner
2014-08-21 20:51 ` Cyrill Gorcunov
2014-08-21 20:51 ` Cyrill Gorcunov
2014-08-21 21:39 ` Kirill A. Shutemov
2014-08-21 21:39 ` Kirill A. Shutemov
2014-08-21 21:46 ` Peter Feiner
2014-08-21 21:46 ` Peter Feiner
2014-08-21 21:51 ` Kirill A. Shutemov
2014-08-21 21:51 ` Kirill A. Shutemov
2014-08-21 22:50 ` Peter Feiner
2014-08-21 22:50 ` Peter Feiner
2014-08-22 6:33 ` Cyrill Gorcunov
2014-08-22 6:33 ` Cyrill Gorcunov
2014-08-23 22:11 ` [PATCH v2 0/3] softdirty fix and write notification cleanup Peter Feiner
2014-08-23 22:11 ` Peter Feiner
2014-08-23 22:11 ` [PATCH v2 1/3] mm: softdirty: enable write notifications on VMAs after VM_SOFTDIRTY cleared Peter Feiner
2014-08-23 22:11 ` Peter Feiner
2014-08-23 23:00 ` Kirill A. Shutemov
2014-08-23 23:00 ` Kirill A. Shutemov
2014-08-23 23:15 ` Peter Feiner
2014-08-23 23:15 ` Peter Feiner
2014-08-23 23:50 ` Kirill A. Shutemov
2014-08-23 23:50 ` Kirill A. Shutemov
2014-08-24 0:55 ` Peter Feiner
2014-08-24 0:55 ` Peter Feiner
2014-08-23 22:12 ` [PATCH v2 2/3] mm: mprotect: preserve special page protection bits Peter Feiner
2014-08-23 22:12 ` Peter Feiner
2014-08-23 22:12 ` [PATCH v2 3/3] mm: mmap: cleanup code that preserves special vm_page_prot bits Peter Feiner
2014-08-23 22:12 ` Peter Feiner
2014-08-24 1:43 ` [PATCH v3] mm: softdirty: enable write notifications on VMAs after VM_SOFTDIRTY cleared Peter Feiner
2014-08-24 1:43 ` Peter Feiner
2014-08-24 7:59 ` Kirill A. Shutemov
2014-08-24 7:59 ` Kirill A. Shutemov
2014-08-24 19:22 ` Cyrill Gorcunov
2014-08-24 19:22 ` Cyrill Gorcunov
2014-08-24 14:41 ` [PATCH v4] " Peter Feiner
2014-08-24 14:41 ` Peter Feiner
2014-08-25 3:34 ` [PATCH v5] " Peter Feiner
2014-08-25 3:34 ` Peter Feiner
2014-08-26 4:45 ` Hugh Dickins
2014-08-26 4:45 ` Hugh Dickins
2014-08-26 6:49 ` Cyrill Gorcunov
2014-08-26 6:49 ` Cyrill Gorcunov
2014-08-26 14:04 ` Kirill A. Shutemov
2014-08-26 14:04 ` Kirill A. Shutemov
2014-08-26 14:19 ` Cyrill Gorcunov
2014-08-26 14:19 ` Cyrill Gorcunov
2014-08-26 14:56 ` Kirill A. Shutemov
2014-08-26 14:56 ` Kirill A. Shutemov
2014-08-26 15:18 ` Cyrill Gorcunov
2014-08-26 15:18 ` Cyrill Gorcunov
2014-08-26 15:43 ` Kirill A. Shutemov
2014-08-26 15:43 ` Kirill A. Shutemov
2014-08-26 15:53 ` Cyrill Gorcunov
2014-08-26 15:53 ` Cyrill Gorcunov
2014-08-27 23:12 ` Hugh Dickins
2014-08-27 23:12 ` Hugh Dickins
2014-08-28 6:31 ` Cyrill Gorcunov
2014-08-28 6:31 ` Cyrill Gorcunov
2014-08-27 21:55 ` Hugh Dickins
2014-08-27 21:55 ` Hugh Dickins
2014-09-04 16:43 ` Peter Feiner
2014-09-04 16:43 ` Peter Feiner
2014-09-07 21:31 ` Peter Feiner [this message]
2014-09-07 21:31 ` Peter Feiner
2014-09-07 23:01 ` [PATCH v6] " Peter Feiner
2014-09-07 23:01 ` Peter Feiner
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=20140907213117.GA388@google.com \
--to=pfeiner@google.com \
--cc=akpm@linux-foundation.org \
--cc=gorcunov@openvz.org \
--cc=hughd@google.com \
--cc=jamieliu@google.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=magnus.damm@gmail.com \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=xemul@parallels.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.