summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2017-09-07 02:23:59 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-07 03:27:29 +0300
commita36985d31a65d5c0559fb582719e32eaf0ccec3b (patch)
tree422c04b7bd357e1f1f23ff4576c139ca272b8546
parent9d4ac934829ac58c5109c49e6dfe677300e5e652 (diff)
downloadlinux-a36985d31a65d5c0559fb582719e32eaf0ccec3b.tar.xz
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> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/userfaultfd.c2
-rw-r--r--include/uapi/linux/userfaultfd.h4
2 files changed, 4 insertions, 2 deletions
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 665bf7a930b2..5419e7da82ba 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -204,7 +204,7 @@ static inline struct uffd_msg userfault_msg(unsigned long address,
*/
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 --git a/include/uapi/linux/userfaultfd.h b/include/uapi/linux/userfaultfd.h
index 2b24c28d99a7..d6d1f65cb3c3 100644
--- a/include/uapi/linux/userfaultfd.h
+++ b/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 {