From: Mike Rapoport <rppt@linux.vnet.ibm.com>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Pavel Emelyanov <xemul@virtuozzo.com>,
Mike Kravetz <mike.kravetz@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm <linux-mm@kvack.org>,
linux-api <linux-api@vger.kernel.org>,
Mike Rapoport <rppt@linux.vnet.ibm.com>
Subject: [RFC PATCH 1/3] userfaultfd: introduce userfaultfd_init_waitqueue helper
Date: Wed, 25 Oct 2017 19:23:35 +0300 [thread overview]
Message-ID: <1508948617-22505-2-git-send-email-rppt@linux.vnet.ibm.com> (raw)
In-Reply-To: <1508948617-22505-1-git-send-email-rppt@linux.vnet.ibm.com>
The helper can be used for initialization of wait queue entries for both
page-fault and non-cooperative events
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
---
fs/userfaultfd.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 1c713fd5b3e6..efa8b4240039 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -131,6 +131,15 @@ static int userfaultfd_wake_function(wait_queue_entry_t *wq, unsigned mode,
return ret;
}
+static inline void userfaultfd_init_waitqueue(struct userfaultfd_ctx *ctx,
+ struct userfaultfd_wait_queue *uwq)
+{
+ init_waitqueue_func_entry(&uwq->wq, userfaultfd_wake_function);
+ uwq->wq.private = current;
+ uwq->ctx = ctx;
+ uwq->waken = false;
+}
+
/**
* userfaultfd_ctx_get - Acquires a reference to the internal userfaultfd
* context.
@@ -441,12 +450,9 @@ int handle_userfault(struct vm_fault *vmf, unsigned long reason)
/* take the reference before dropping the mmap_sem */
userfaultfd_ctx_get(ctx);
- init_waitqueue_func_entry(&uwq.wq, userfaultfd_wake_function);
- uwq.wq.private = current;
+ userfaultfd_init_waitqueue(ctx, &uwq);
uwq.msg = userfault_msg(vmf->address, vmf->flags, reason,
ctx->features);
- uwq.ctx = ctx;
- uwq.waken = false;
return_to_userland =
(vmf->flags & (FAULT_FLAG_USER|FAULT_FLAG_KILLABLE)) ==
--
2.7.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-10-25 16:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-25 16:23 [RFC PATCH 0/3] userfaultfd: non-cooperative: syncronous events Mike Rapoport
2017-10-25 16:23 ` Mike Rapoport [this message]
2017-10-25 16:23 ` [RFC PATCH 2/3] userfaultfd: non-cooperative: generalize wake key structure Mike Rapoport
2017-10-25 16:23 ` [RFC PATCH 3/3] userfaultfd: non-cooperative: allow synchronous EVENT_REMOVE Mike Rapoport
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=1508948617-22505-2-git-send-email-rppt@linux.vnet.ibm.com \
--to=rppt@linux.vnet.ibm.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dgilbert@redhat.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=xemul@virtuozzo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox