Axel Rasmussen
f619147104
userfaultfd: add UFFDIO_CONTINUE ioctl
This ioctl is how userspace ought to resolve "minor" userfaults. The
idea is, userspace is notified that a minor fault has occurred. It
might change the contents of the page using its second non-UFFD mapping,
or not. Then, it calls UFFDIO_CONTINUE to tell the kernel "I have
ensured the page contents are correct, carry on setting up the mapping".
Note that it doesn't make much sense to use UFFDIO_{COPY,ZEROPAGE} for
MINOR registered VMAs. ZEROPAGE maps the VMA to the zero page; but in
the minor fault case, we already have some pre-existing underlying page.
Likewise, UFFDIO_COPY isn't useful if we have a second non-UFFD mapping.
We'd just use memcpy() or similar instead.
It turns out hugetlb_mcopy_atomic_pte() already does very close to what
we want, if an existing page is provided via `struct page **pagep`. We
already special-case the behavior a bit for the UFFDIO_ZEROPAGE case, so
just extend that design: add an enum for the three modes of operation,
and make the small adjustments needed for the MCOPY_ATOMIC_CONTINUE
case. (Basically, look up the existing page, and avoid adding the
existing page to the page cache or calling set_page_huge_active() on
it.)
Link: https://lkml.kernel.org/r/20210301222728.176417-5-axelrasmussen@google.com
Signed-off-by: Axel Rasmussen <axelrasmussen@google.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Cc: Adam Ruprecht <ruprecht@google.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Cannon Matthews <cannonmatthews@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Chinwen Chang <chinwen.chang@mediatek.com>
Cc: David Rientjes <rientjes@google.com>
Cc: "Dr . David Alan Gilbert" <dgilbert@redhat.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Lokesh Gidra <lokeshgidra@google.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: "Michal Koutn" <mkoutny@suse.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Mina Almasry <almasrymina@google.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Oliver Upton <oupton@google.com>
Cc: Shaohua Li <shli@fb.com>
Cc: Shawn Anastasio <shawn@anastas.io>
Cc: Steven Price <steven.price@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-05-05 11:27:22 -07:00
..
2021-03-12 22:15:22 -05:00
2021-01-24 14:27:20 +01:00
2021-02-23 13:39:45 -08:00
2021-04-27 13:27:39 -07:00
2021-01-24 14:27:20 +01:00
2021-03-30 16:54:49 -07:00
2021-01-24 14:27:20 +01:00
2021-04-27 11:18:24 -07:00
2021-04-23 10:14:32 +01:00
2021-03-08 10:19:37 -05:00
2021-04-27 10:57:42 -07:00
2021-04-23 14:42:39 -07:00
2021-03-11 12:13:48 +01:00
2021-01-05 23:02:47 -05:00
2021-04-26 08:51:23 -07:00
2021-04-28 13:33:57 -07:00
2020-11-10 12:14:20 -06:00
2021-04-12 15:04:29 +02:00
2021-04-12 15:04:29 +02:00
2020-09-18 16:45:50 -04:00
2021-04-10 03:20:19 +08:00
2021-04-27 20:45:07 +09:00
2020-12-09 09:39:38 -05:00
2021-04-29 11:06:13 -07:00
2021-04-29 11:06:13 -07:00
2021-04-27 13:08:12 -07:00
2021-02-23 13:39:45 -08:00
2021-04-23 10:14:32 +01:00
2021-04-27 11:18:24 -07:00
2021-05-05 11:27:19 -07:00
2021-01-24 14:27:20 +01:00
2021-04-12 15:04:29 +02:00
2021-04-27 10:57:42 -07:00
2021-01-24 14:27:20 +01:00
2021-05-05 11:27:21 -07:00
2021-04-30 11:20:36 -07:00
2021-02-03 19:05:52 +01:00
2021-01-27 09:51:48 -07:00
2021-03-30 16:54:49 -07:00
2021-04-12 15:04:29 +02:00
2021-02-23 13:39:45 -08:00
2021-01-25 09:36:23 -05:00
2021-01-24 14:27:20 +01:00
2021-04-26 23:23:41 +01:00
2021-04-27 13:42:11 -07:00
2021-03-22 10:19:00 -04:00
2021-04-27 10:57:42 -07:00
2021-04-12 15:04:30 +02:00
2021-03-25 15:33:45 +01:00
2021-02-24 13:38:26 -08:00
2021-04-30 11:20:35 -07:00
2021-01-24 14:27:20 +01:00
2021-03-12 22:15:22 -05:00
2021-04-27 11:18:24 -07:00
2021-04-27 11:18:24 -07:00
2021-05-05 11:27:22 -07:00
2021-04-27 18:09:44 -07:00
2020-09-18 16:45:50 -04:00
2020-09-18 16:45:50 -04:00
2021-03-18 17:03:54 +01:00
2021-02-24 13:38:26 -08:00
2021-04-29 10:51:29 -07:00
2020-10-24 12:26:05 -07:00
2021-03-25 09:22:55 -07:00
2021-01-12 14:26:31 +01:00
2021-01-24 14:27:20 +01:00
2021-01-24 14:27:20 +01:00
2021-04-27 11:18:24 -07:00
2021-02-23 13:39:45 -08:00
2021-01-24 14:27:20 +01:00
2020-09-10 14:03:31 -07:00
2021-03-12 22:15:00 -05:00
2021-04-22 17:31:32 +10:00
2021-04-29 10:43:51 -07:00
2021-04-29 11:06:13 -07:00
2021-04-30 11:20:39 -07:00
2021-01-15 12:17:25 -05:00
2021-01-24 14:27:20 +01:00
2021-01-24 14:27:20 +01:00
2021-03-08 10:21:11 -05:00
2021-03-08 10:21:11 -05:00
2020-08-24 08:49:13 +10:00
2021-03-13 11:27:30 -08:00
2021-05-05 11:27:19 -07:00
2021-02-24 13:38:30 -08:00
2021-01-06 08:42:51 -05:00
2021-03-08 10:21:11 -05:00
2020-10-14 14:54:45 -07:00
2021-05-05 11:27:19 -07:00
2021-02-24 13:38:26 -08:00
2021-04-09 14:54:23 -07:00
2020-11-15 09:49:10 -05:00
2021-03-06 17:36:53 -07:00
2021-02-24 13:38:26 -08:00
2021-02-23 13:39:45 -08:00
2021-02-24 13:38:26 -08:00
2020-10-25 20:02:08 -04:00
2021-04-02 14:11:10 +02:00
2020-08-23 17:36:59 -05:00
2021-04-30 11:20:35 -07:00
2020-07-29 16:14:27 +02:00
2021-01-13 17:26:50 +01:00
2020-08-23 17:36:59 -05:00
2021-01-24 14:27:19 +01:00
2021-05-05 11:27:20 -07:00
2021-02-23 13:39:45 -08:00
2021-04-28 14:56:09 -07:00
2021-04-20 11:24:22 -06:00
2021-04-11 17:42:00 -06:00
2021-04-12 15:04:23 +02:00
2021-04-23 10:14:32 +01:00
2021-02-21 09:29:23 -08:00
2020-10-05 13:37:04 +02:00
2021-03-23 11:20:25 +01:00
2021-04-26 13:24:39 -07:00
2021-04-23 10:14:32 +01:00
2021-01-24 14:29:34 +01:00
2021-03-11 07:47:48 -07:00
2021-04-27 12:49:42 -07:00
2021-03-31 14:22:55 -06:00
2021-02-23 13:39:45 -08:00
2021-02-24 13:38:26 -08:00
2021-03-08 15:18:43 +01:00
2021-01-24 14:27:20 +01:00
2021-01-24 14:43:45 +01:00
2021-01-25 23:29:36 -05:00
2021-04-17 11:39:49 -07:00
2021-01-24 14:27:19 +01:00
2021-03-16 22:13:10 +01:00
2021-04-27 15:50:15 -07:00
2021-04-16 16:32:41 +02:00
2021-02-21 11:02:48 -08:00
2021-01-24 14:27:20 +01:00
2021-02-13 17:17:53 +01:00
2021-02-22 10:57:46 -08:00
2021-05-05 11:27:22 -07:00
2021-01-24 14:27:18 +01:00
2021-03-23 11:20:26 +01:00