linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Mike Rapoprt <rppt@linux.vnet.ibm.com>
Cc: mtk.manpages@gmail.com, Andrea Arcangeli <aarcange@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-man@vger.kernel.org
Subject: Re: [PATCH man-pages 1/2] userfaultfd.2: start documenting non-cooperative events
Date: Mon, 1 May 2017 20:34:16 +0200	[thread overview]
Message-ID: <3cff5638-cb15-50e6-f5a4-d9a0fce643c5@gmail.com> (raw)
In-Reply-To: <190E3CFC-492F-4672-9385-9C3D8F57F26C@linux.vnet.ibm.com>

Hi Mike,

On 04/28/2017 11:45 AM, Mike Rapoprt wrote:
> 
> 
> On April 27, 2017 8:26:16 PM GMT+03:00, "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> wrote:
>> Hi Mike,
>>
>> I've applied this, but have some questions/points I think 
>> further clarification.
>>
>> On 04/27/2017 04:14 PM, Mike Rapoport wrote:
>>> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
>>> ---
>>>  man2/userfaultfd.2 | 135
>> ++++++++++++++++++++++++++++++++++++++++++++++++++---
>>>  1 file changed, 128 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/man2/userfaultfd.2 b/man2/userfaultfd.2
>>> index cfea5cb..44af3e4 100644
>>> --- a/man2/userfaultfd.2
>>> +++ b/man2/userfaultfd.2
>>> @@ -75,7 +75,7 @@ flag in
>>>  .PP
>>>  When the last file descriptor referring to a userfaultfd object is
>> closed,
>>>  all memory ranges that were registered with the object are
>> unregistered
>>> -and unread page-fault events are flushed.
>>> +and unread events are flushed.
>>>  .\"
>>>  .SS Usage
>>>  The userfaultfd mechanism is designed to allow a thread in a
>> multithreaded
>>> @@ -99,6 +99,20 @@ In such non-cooperative mode,
>>>  the process that monitors userfaultfd and handles page faults
>>>  needs to be aware of the changes in the virtual memory layout
>>>  of the faulting process to avoid memory corruption.
>>> +
>>> +Starting from Linux 4.11,
>>> +userfaultfd may notify the fault-handling threads about changes
>>> +in the virtual memory layout of the faulting process.
>>> +In addition, if the faulting process invokes
>>> +.BR fork (2)
>>> +system call,
>>> +the userfaultfd objects associated with the parent may be duplicated
>>> +into the child process and the userfaultfd monitor will be notified
>>> +about the file descriptor associated with the userfault objects
>>
>> What does "notified about the file descriptor" mean?
> 
> Well, seems that I've made this one really awkward :)
> When the monitored process forks, all the userfault objects
> associated​ with it are duplicated into the child process. For each
> duplicated object, userfault generates event of type UFFD_EVENT_FORK
> and the uffdio_msg for this event contains the file descriptor that
> should be used to manipulate the duplicated userfault object.
> Hope this clarifies.

Yes, it's clearer now.

Mostly what was needed here was a forward reference that mentions
UFFD_EVENT_FORK explicitly. I added that, and also enhanced the
text on UFFD_EVENT_FORK a little.

Also, it's not just fork(2) for which UFFD_EVENT_FORK is generated,
right? It can also be a clone(2) cal that does not specify
CLONE_VM, right?

Could you review my changes in commit 522ab2ff6fc9010432a
to make sure they are okay.

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

  reply	other threads:[~2017-05-01 18:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27 14:14 [PATCH man-pages 0/2] some more userfault pages updates Mike Rapoport
2017-04-27 14:14 ` [PATCH man-pages 1/2] userfaultfd.2: start documenting non-cooperative events Mike Rapoport
2017-04-27 17:26   ` Michael Kerrisk (man-pages)
2017-04-28  9:45     ` Mike Rapoprt
2017-05-01 18:34       ` Michael Kerrisk (man-pages) [this message]
2017-05-02  9:22         ` Mike Rapoport
2017-05-02 20:19           ` Michael Kerrisk (man-pages)
2017-04-27 14:14 ` [PATCH man-pages 2/2] ioctl_userfaultfd.2: start adding details about userfaultfd features Mike Rapoport
2017-04-27 17:26   ` Michael Kerrisk (man-pages)

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=3cff5638-cb15-50e6-f5a4-d9a0fce643c5@gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=aarcange@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@linux.vnet.ibm.com \
    --subject='Re: [PATCH man-pages 1/2] userfaultfd.2: start documenting non-cooperative events' \
    /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).