Set this to avoid premature return from schedule in IOU worker threads, ensuring it sleeps and waits to be woken up as in normal cases. Signed-off-by: Zhiwei Jiang <qq282012236@xxxxxxxxx> --- fs/userfaultfd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index d80f94346199..972eb10925a9 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -32,6 +32,7 @@ #include <linux/swapops.h> #include <linux/miscdevice.h> #include <linux/uio.h> +#include "../io_uring/io-wq.h" static int sysctl_unprivileged_userfaultfd __read_mostly; @@ -370,6 +371,7 @@ vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason) bool must_wait; unsigned int blocking_state; + set_userfault_flag_for_ioworker(); /* * We don't do userfault handling for the final child pid update * and when coredumping (faults triggered by get_dump_page()). @@ -506,6 +508,8 @@ vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason) __set_current_state(TASK_RUNNING); + clear_userfault_flag_for_ioworker(); + /* * Here we race with the list_del; list_add in * userfaultfd_ctx_read(), however because we don't ever run -- 2.34.1