All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 097/119] userfaultfd: provide pid in userfault msg - add feat union
@ 2017-09-06 23:23 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2017-09-06 23:23 UTC (permalink / raw)
  To: a.perevalov, aarcange, akpm, dgilbert, maxime.coquelin,
	mike.kravetz, mm-commits, rppt, torvalds

From: Andrea Arcangeli <aarcange@redhat.com>
Subject: userfaultfd: provide pid in userfault msg - add feat union

No ABI change, but this will make it more explicit to software that ptid
is only available if requested by passing UFFD_FEATURE_THREAD_ID to
UFFDIO_API.  The fact it's a union will also self document it shouldn't be
taken for granted there's a tpid there.

Link: http://lkml.kernel.org/r/20170802165145.22628-7-aarcange@redhat.com
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Alexey Perevalov <a.perevalov@samsung.com>
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/userfaultfd.c                 |    2 +-
 include/uapi/linux/userfaultfd.h |    4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff -puN fs/userfaultfd.c~userfaultfd-provide-pid-in-userfault-msg-add-feat-union fs/userfaultfd.c
--- a/fs/userfaultfd.c~userfaultfd-provide-pid-in-userfault-msg-add-feat-union
+++ a/fs/userfaultfd.c
@@ -204,7 +204,7 @@ static inline struct uffd_msg userfault_
 		 */
 		msg.arg.pagefault.flags |= UFFD_PAGEFAULT_FLAG_WP;
 	if (features & UFFD_FEATURE_THREAD_ID)
-		msg.arg.pagefault.ptid = task_pid_vnr(current);
+		msg.arg.pagefault.feat.ptid = task_pid_vnr(current);
 	return msg;
 }
 
diff -puN include/uapi/linux/userfaultfd.h~userfaultfd-provide-pid-in-userfault-msg-add-feat-union include/uapi/linux/userfaultfd.h
--- a/include/uapi/linux/userfaultfd.h~userfaultfd-provide-pid-in-userfault-msg-add-feat-union
+++ a/include/uapi/linux/userfaultfd.h
@@ -80,7 +80,9 @@ struct uffd_msg {
 		struct {
 			__u64	flags;
 			__u64	address;
-			__u32   ptid;
+			union {
+				__u32 ptid;
+			} feat;
 		} pagefault;
 
 		struct {
_

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-06 23:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-06 23:23 [patch 097/119] userfaultfd: provide pid in userfault msg - add feat union akpm

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.