All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: Dimitris Siakavaras <jimsiak@cslab.ece.ntua.gr>
Cc: Axel Rasmussen <axelrasmussen@google.com>,
	linux-kernel@vger.kernel.org, Peter Xu <peterx@redhat.com>,
	linux-mm@kvack.org
Subject: Re: Using userfaultfd with KVM's async page fault handling causes processes to hung waiting for mmap_lock to be released
Date: Thu, 20 Jul 2023 18:35:34 +0800	[thread overview]
Message-ID: <20230720103534.312-1-hdanton@sina.com> (raw)
In-Reply-To: <CAJHvVcj+Sc41mfercqxBii5cqRBEgZxNix2R1YMi04K-5nBh8w@mail.gmail.com>

On Wed, Jul 19, 2023 at 2:16 PM Axel Rasmussen <axelrasmussen@google.com> wrote:
>
> I think perhaps the right thing to do is to have handle_userfault() release
> mmap_lock when it returns VM_FAULT_NOPAGE, and to have GUP deal with that
> appropriately? But, some investigation is required to be sure that's okay to do
> in the other non-GUP ways we can end up in handle_userfault().

See if making kworker special works.

--- x/fs/userfaultfd.c
+++ y/fs/userfaultfd.c
@@ -457,6 +457,8 @@ vm_fault_t handle_userfault(struct vm_fa
 		 * close the uffd.
 		 */
 		ret = VM_FAULT_NOPAGE;
+		if (current->flags & PF_WQ_WORKER)
+			ret = VM_FAULT_OOM;
 		goto out;
 	}
 
--


  reply	other threads:[~2023-07-20 10:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 14:33 Using userfaultfd with KVM's async page fault handling causes processes to hung waiting for mmap_lock to be released Dimitris Siakavaras
2023-07-19 21:16 ` Axel Rasmussen
2023-07-19 21:54   ` Axel Rasmussen
2023-07-20 10:35     ` Hillf Danton [this message]
2023-07-20 20:07       ` Peter Xu
2023-07-20 20:06     ` Peter Xu
2025-03-07  7:21 ` Jinjiang Tu
2025-03-07  8:07   ` Jinjiang Tu
2025-03-07 13:11     ` jimsiak
2025-03-07 22:41       ` Peter Xu
2025-03-10  6:40         ` Jinjiang Tu
2025-03-10 18:50           ` Peter Xu
2025-03-11  8:14             ` Jinjiang Tu
2025-03-12  9:18               ` Jinjiang Tu
2025-03-12 14:09                 ` Peter Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230720103534.312-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=axelrasmussen@google.com \
    --cc=jimsiak@cslab.ece.ntua.gr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=peterx@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.