[<prev] [next>] [day] [month] [year] [list]
Message-ID: <ZLmUHI+iyhj6QcYL@x1n>
Date: Thu, 20 Jul 2023 16:07:56 -0400
From: Peter Xu <peterx@...hat.com>
To: Hillf Danton <hdanton@...a.com>
Cc: Dimitris Siakavaras <jimsiak@...ab.ece.ntua.gr>,
Axel Rasmussen <axelrasmussen@...gle.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: Using userfaultfd with KVM's async page fault handling causes
processes to hung waiting for mmap_lock to be released
On Thu, Jul 20, 2023 at 06:35:34PM +0800, Hillf Danton wrote:
> On Wed, Jul 19, 2023 at 2:16 PM Axel Rasmussen <axelrasmussen@...gle.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;
> }
Sorry this won't work - we need userfault to work with all forms of
kworkers, especially including kvm async pf. Thanks.
--
Peter Xu
Powered by blists - more mailing lists