Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965352AbbEMOwq (ORCPT ); Wed, 13 May 2015 10:52:46 -0400 Received: from mx2.parallels.com ([199.115.105.18]:47770 "EHLO mx2.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934074AbbEMOwp (ORCPT ); Wed, 13 May 2015 10:52:45 -0400 Message-ID: <55536534.5080605@parallels.com> Date: Wed, 13 May 2015 17:52:36 +0300 From: Pavel Emelyanov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Andrea Arcangeli CC: Linux Kernel Mailing List , Linux MM , Sanidhya Kashyap Subject: [PATCH 1/5] uffd: Split the find_userfault() routine References: <5553651B.1020909@parallels.com> In-Reply-To: <5553651B.1020909@parallels.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: US-EXCH2.sw.swsoft.com (10.255.249.46) To US-EXCH2.sw.swsoft.com (10.255.249.46) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1770 Lines: 57 I will need one to lookup for userfaultfd_wait_queue-s in different wait queue. Signed-off-by: Pavel Emelyanov --- fs/userfaultfd.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index c89e96f..c593a72 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -433,23 +433,29 @@ static int userfaultfd_release(struct inode *inode, struct file *file) } /* fault_pending_wqh.lock must be hold by the caller */ -static inline struct userfaultfd_wait_queue *find_userfault( - struct userfaultfd_ctx *ctx) +static inline struct userfaultfd_wait_queue *find_userfault_in( + wait_queue_head_t *wqh) { wait_queue_t *wq; struct userfaultfd_wait_queue *uwq; - VM_BUG_ON(!spin_is_locked(&ctx->fault_pending_wqh.lock)); + VM_BUG_ON(!spin_is_locked(&wqh->lock)); uwq = NULL; - if (!waitqueue_active(&ctx->fault_pending_wqh)) + if (!waitqueue_active(wqh)) goto out; /* walk in reverse to provide FIFO behavior to read userfaults */ - wq = list_last_entry(&ctx->fault_pending_wqh.task_list, - typeof(*wq), task_list); + wq = list_last_entry(&wqh->task_list, typeof(*wq), task_list); uwq = container_of(wq, struct userfaultfd_wait_queue, wq); out: return uwq; + +} + +static inline struct userfaultfd_wait_queue *find_userfault( + struct userfaultfd_ctx *ctx) +{ + return find_userfault_in(&ctx->fault_pending_wqh); } static unsigned int userfaultfd_poll(struct file *file, poll_table *wait) -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/