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-04-10 10:52:04 +02:00
2020-12-10 09:31:40 +01:00
2020-12-14 09:16:22 -06:00
2021-03-11 20:47:05 +00:00
2021-01-25 18:44:44 +01:00
2021-04-27 18:06:29 +02:00
2021-03-31 15:59:14 -04:00
2020-11-19 11:25:47 +01:00
2020-12-28 14:21:31 +00:00
2021-03-17 18:39:38 +01:00
2021-03-18 09:02:27 +01:00
2021-02-09 10:58:19 +01:00
2021-02-06 09:22:10 +01:00
2021-02-06 09:22:10 +01:00
2021-01-09 09:21:03 -07:00
2021-02-15 18:28:30 +01:00
2021-04-02 11:18:30 -06:00
2021-04-19 15:27:36 -07:00
2021-03-04 17:58:15 -08:00
2020-12-09 19:16:10 +01:00
2020-12-08 15:54:16 +01:00
2021-03-29 09:51:49 +02:00
2021-04-20 14:28:33 -07:00
2021-01-12 17:31:14 +01:00
2021-03-22 10:22:22 +01:00
2020-10-29 18:39:43 -07:00
2020-12-04 12:06:15 +01:00
2020-12-15 12:13:36 -08:00
2021-02-16 20:36:39 -08:00
2021-01-22 11:32:08 -08:00
2021-02-11 09:45:25 -05:00
2021-03-18 17:03:54 +01:00
2021-04-13 17:31:44 +01:00
2021-04-16 16:59:20 -07:00
2021-04-16 16:59:20 -07:00
2020-12-03 00:12:08 -08:00
2021-04-20 08:59:03 -06:00
2021-02-26 09:41:03 -08:00
2020-11-16 11:41:12 -08:00
2021-01-27 15:13:52 +01:00
2021-02-07 14:51:19 -08:00
2021-03-16 15:20:16 +01:00
2021-02-08 13:01:24 +01:00
2021-02-15 11:43:33 +01:00
2021-02-04 09:29:57 -08:00
2020-11-27 15:48:31 +01:00
2021-01-22 09:58:57 +01:00
2021-01-22 09:59:00 +01:00
2021-04-28 13:42:23 -07:00
2021-03-30 13:29:39 -07:00
2021-04-12 13:26:03 +05:30
2020-11-06 14:29:11 +11:00
2021-01-19 19:30:32 -08:00
2020-10-30 17:49:19 -07:00
2020-10-29 18:39:43 -07:00
2021-03-10 12:45:16 -08:00
2021-04-25 18:35:01 -07:00
2020-11-09 16:41:40 -08:00
2021-02-04 09:29:57 -08:00
2021-02-26 09:41:03 -08:00
2021-04-25 10:14:04 -06:00
2021-01-26 18:39:45 -08:00
2020-11-16 16:27:03 +01:00
2020-12-15 12:13:36 -08:00
2020-11-04 16:43:38 +01:00
2021-03-23 23:40:55 -04:00
2021-03-02 14:30:54 -05:00
2021-03-03 16:55:02 -08:00
2021-04-13 09:16:12 -06:00
2020-11-26 14:19:10 +01:00
2021-03-10 09:34:06 +01:00
2021-03-24 08:26:29 +01:00
2021-04-08 13:15:33 -07:00
2020-12-14 11:47:37 -08:00
2021-01-12 17:05:37 +01:00
2021-02-24 13:38:34 -08:00
2021-01-24 14:43:45 +01:00
2021-04-02 14:21:50 -07:00
2020-12-15 12:13:36 -08:00
2021-01-23 12:38:42 -08:00
2020-12-15 12:13:36 -08:00
2021-03-11 16:12:59 -08:00
2021-01-25 09:36:25 -05:00
2020-10-16 09:28:43 -04:00
2021-04-19 12:04:37 +02:00
2021-01-04 11:42:26 -05:00
2020-11-27 11:03:06 -08:00
2020-12-15 16:49:59 -08:00
2021-04-19 20:03:29 +02:00
2021-03-13 14:18:09 -08:00
2021-01-22 20:41:29 -08:00
2020-12-21 17:36:48 -08:00
2021-04-13 17:31:44 +01:00
2021-03-25 15:31:22 -07:00
2021-03-17 16:15:39 +01:00
2021-04-08 10:14:45 +02:00
2021-04-06 10:29:56 +02:00
2021-01-25 15:14:16 -08:00
2020-11-24 10:10:59 -06:00
2021-01-16 23:19:26 +01:00
2021-03-24 16:31:23 -07:00
2020-10-30 15:24:11 -07:00
2020-12-04 13:30:50 -08:00
2021-01-15 17:14:49 +01:00
2021-03-10 09:34:06 +01:00
2021-04-16 16:32:41 +02:00
2020-12-01 17:56:13 -08:00
2020-11-09 15:34:44 -08:00
2020-12-03 10:03:14 -08:00
2021-01-26 18:39:45 -08:00
2021-02-11 18:25:05 -08:00
2021-02-02 14:50:15 +01:00
2021-01-07 16:17:32 +01:00
2020-11-27 14:32:37 -08:00
2021-04-10 10:36:34 +02:00
2021-05-05 11:27:22 -07:00
2021-03-22 10:24:07 +01:00
2021-04-06 14:56:00 +02:00
2021-03-22 10:22:22 +01:00
2021-02-23 07:52:56 -05:00
2021-04-06 11:54:13 -06:00
2020-10-23 11:55:28 -04:00
2020-10-23 11:55:28 -04:00
2021-04-06 14:56:00 +02:00
2021-04-08 12:26:34 +02:00
2020-11-20 10:44:41 +01:00
2021-04-08 12:26:34 +02:00
2020-12-14 19:33:39 -08:00