From patchwork Mon Oct 31 10:02:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 9405209 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 175F860585 for ; Mon, 31 Oct 2016 10:04:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F037129347 for ; Mon, 31 Oct 2016 10:04:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2D6229354; Mon, 31 Oct 2016 10:04:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62A3E29347 for ; Mon, 31 Oct 2016 10:04:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764640AbcJaKEZ (ORCPT ); Mon, 31 Oct 2016 06:04:25 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33319 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764396AbcJaKCy (ORCPT ); Mon, 31 Oct 2016 06:02:54 -0400 Received: by mail-wm0-f68.google.com with SMTP id m83so17632789wmc.0; Mon, 31 Oct 2016 03:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Wa0/RD+r1l+CVLRaod8QdDd0akI+FHUyBrVXM+iyga4=; b=WYHSLV/rf0+Ij/1Em00t4kQ7AX2pqcngQO971jNQpsfVFPOaHde1azw0fcy5OogJyv bzGdOA6Y9wnxLY34gO8MBMCaNniLRnvGVmnOyFKc59iIt3RZHyPBNfQtC3NkXxDTMG5N xdHVSf1llaKZBDWZ2t/smvi1efPgSU+3g68l4NXyjEbvAW2OKNa3r4YyE2VM5i4c+wsO RjQH9O12SE0odRSnsa0+wOGRTnNQBQJKEbBhNlr+asaWx7l4QzLNXLInZGUHM9D8NQk3 M4NvTr6g3NpsfrgI3TEBt2wCWpsziJjAOn30kljiejg8KQ5CM1duuCI0d2767j6eEe+R Kd5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Wa0/RD+r1l+CVLRaod8QdDd0akI+FHUyBrVXM+iyga4=; b=VzOYJ5mGIKFiw7fS1q3vnpOm6rnRValODbr0wB9I6tBxb0pyTjovRg+SKEdpHU4TdT dgvTD87VcSTJUqO/Ux6O6yKK09SsN7ihEdedyv1RC+JPFHMd+x6pmUSnvZ3JPffQw/Y7 /+F0P7uOgPtR7SlTMi1H0F7i9DIl6tNdtC2BMGs8alQn152FfKUahVy5RDp3xyNKFxVL mo74CeZLWj+OIBnHBwTyICFisynOy7ydZKRjgSi3C7tc1xE9Awg5XDMR3mvvp9Ai+XEj 30LVW5PXT7gRTmwqAarb9hJXEWFB9WpA4yWjysKR0Z/WpB05r+kkyRQ0I1Bdkg4ESHd/ rzvA== X-Gm-Message-State: ABUngvec5x5t/Wa5mp3p35CaYeoS0R6A3fLnCEXWqg4kr5Ls/PLYmaY1r9VQr62XAF+A3w== X-Received: by 10.194.153.199 with SMTP id vi7mr21553864wjb.137.1477908172530; Mon, 31 Oct 2016 03:02:52 -0700 (PDT) Received: from localhost (cpc94060-newt37-2-0-cust185.19-3.cable.virginm.net. [92.234.204.186]) by smtp.gmail.com with ESMTPSA id j185sm23927604wmg.13.2016.10.31.03.02.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Oct 2016 03:02:50 -0700 (PDT) From: Lorenzo Stoakes To: linux-mm@kvack.org Cc: Linus Torvalds , Michal Hocko , Jan Kara , Hugh Dickins , Dave Hansen , Rik van Riel , Mel Gorman , Andrew Morton , Paolo Bonzini , linux-kernel@vger.kernel.org, linux-cris-kernel@axis.com, linux-ia64@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, kvm@vger.kernel.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org, Lorenzo Stoakes Subject: [PATCH 2/2] mm: remove get_user_pages_locked() Date: Mon, 31 Oct 2016 10:02:28 +0000 Message-Id: <20161031100228.17917-3-lstoakes@gmail.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161031100228.17917-1-lstoakes@gmail.com> References: <20161031100228.17917-1-lstoakes@gmail.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP get_user_pages() now has an int *locked parameter which renders get_user_pages_locked() redundant, so remove it. This patch should not introduce any functional changes. Signed-off-by: Lorenzo Stoakes --- include/linux/mm.h | 2 -- mm/frame_vector.c | 4 ++-- mm/gup.c | 56 +++++++++++++++++++----------------------------------- mm/nommu.c | 8 -------- 4 files changed, 22 insertions(+), 48 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 396984e..4db3147 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1278,8 +1278,6 @@ long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, long get_user_pages(unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages, struct vm_area_struct **vmas, int *locked); -long get_user_pages_locked(unsigned long start, unsigned long nr_pages, - unsigned int gup_flags, struct page **pages, int *locked); long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, unsigned long nr_pages, struct page **pages, unsigned int gup_flags); diff --git a/mm/frame_vector.c b/mm/frame_vector.c index db77dcb..c5ce1b1 100644 --- a/mm/frame_vector.c +++ b/mm/frame_vector.c @@ -55,8 +55,8 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames, if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) { vec->got_ref = true; vec->is_pfns = false; - ret = get_user_pages_locked(start, nr_frames, - gup_flags, (struct page **)(vec->ptrs), &locked); + ret = get_user_pages(start, nr_frames, + gup_flags, (struct page **)(vec->ptrs), NULL, &locked); goto out; } diff --git a/mm/gup.c b/mm/gup.c index 6b5539e..6cec693 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -826,37 +826,6 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk, } /* - * We can leverage the VM_FAULT_RETRY functionality in the page fault - * paths better by using either get_user_pages_locked() or - * get_user_pages_unlocked(). - * - * get_user_pages_locked() is suitable to replace the form: - * - * down_read(&mm->mmap_sem); - * do_something() - * get_user_pages(tsk, mm, ..., pages, NULL, NULL); - * up_read(&mm->mmap_sem); - * - * to: - * - * int locked = 1; - * down_read(&mm->mmap_sem); - * do_something() - * get_user_pages_locked(tsk, mm, ..., pages, &locked); - * if (locked) - * up_read(&mm->mmap_sem); - */ -long get_user_pages_locked(unsigned long start, unsigned long nr_pages, - unsigned int gup_flags, struct page **pages, - int *locked) -{ - return __get_user_pages_locked(current, current->mm, start, nr_pages, - pages, NULL, locked, true, - gup_flags | FOLL_TOUCH); -} -EXPORT_SYMBOL(get_user_pages_locked); - -/* * Same as get_user_pages_unlocked(...., FOLL_TOUCH) but it allows to * pass additional gup_flags as last parameter (like FOLL_HWPOISON). * @@ -954,11 +923,6 @@ EXPORT_SYMBOL(get_user_pages_unlocked); * use the correct cache flushing APIs. * * See also get_user_pages_fast, for performance critical applications. - * - * get_user_pages should be phased out in favor of - * get_user_pages_locked|unlocked or get_user_pages_fast. Nothing - * should use get_user_pages because it cannot pass - * FAULT_FLAG_ALLOW_RETRY to handle_mm_fault. */ long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, unsigned long nr_pages, @@ -976,6 +940,26 @@ EXPORT_SYMBOL(get_user_pages_remote); * less-flexible calling convention where we assume that the task * and mm being operated on are the current task's. We also * obviously don't pass FOLL_REMOTE in here. + * + * We can leverage the VM_FAULT_RETRY functionality in the page fault + * paths better by using either get_user_pages()'s locked parameter or + * get_user_pages_unlocked(). + * + * get_user_pages()'s locked parameter is suitable to replace the form: + * + * down_read(&mm->mmap_sem); + * do_something() + * get_user_pages(tsk, mm, ..., pages, NULL, NULL); + * up_read(&mm->mmap_sem); + * + * to: + * + * int locked = 1; + * down_read(&mm->mmap_sem); + * do_something() + * get_user_pages(tsk, mm, ..., pages, NULL, &locked); + * if (locked) + * up_read(&mm->mmap_sem); */ long get_user_pages(unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages, diff --git a/mm/nommu.c b/mm/nommu.c index 82aaa33..3d38d40 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -168,14 +168,6 @@ long get_user_pages(unsigned long start, unsigned long nr_pages, } EXPORT_SYMBOL(get_user_pages); -long get_user_pages_locked(unsigned long start, unsigned long nr_pages, - unsigned int gup_flags, struct page **pages, - int *locked) -{ - return get_user_pages(start, nr_pages, gup_flags, pages, NULL, NULL); -} -EXPORT_SYMBOL(get_user_pages_locked); - long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, unsigned long nr_pages, struct page **pages, unsigned int gup_flags)