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: 9406769 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 95D4460721 for ; Tue, 1 Nov 2016 01:08:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8756E28ADB for ; Tue, 1 Nov 2016 01:08:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AFDD2938C; Tue, 1 Nov 2016 01:08:56 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DE3D928ADB for ; Tue, 1 Nov 2016 01:08:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E16F6E3A2; Tue, 1 Nov 2016 01:08:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id EEF0F6E1FE for ; Mon, 31 Oct 2016 10:02:53 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id c17so17652297wmc.3 for ; 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=QUHZEnwvH3z5P0IG+wuZknttbxX2DHM/zU1deKQecakyYUS0wxEoDgNMkkGv3/l64x SA0thICJ/0tc8ZnesLXJ1Py6ltBQyCeLNCuaV5H0BCO4Rcrb9nSdLHCW7WYOJeh8fkDZ EtRF82hMFJBBi6wR0j+8L3Fqg6RLFza4ijetfwgjjWDRAVdM7T8TpqFOw9xhSB14jpTe rqNXolIM2nL770NNxBUg6CLQiKhIS3zx+5z1oxDOngU8qxh5bnRYoRiq+O4IbEHK8Rm+ R72VjZg2E+p4GkAoDp7kH3wjy7J6BZ7coTL8+wCHYi2DiYL175bmkjqiuHg7XqndH4bG xkrg== X-Gm-Message-State: ABUngvdRyv4Lx+T0PX/HHo+xCeIaLCyWaU7K3KPtrH4XzcIooWTQTfYlbKDR/gvSSg8FBQ== 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 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> X-Mailman-Approved-At: Tue, 01 Nov 2016 01:08:23 +0000 Cc: devel@driverdev.osuosl.org, Rik van Riel , Jan Kara , kvm@vger.kernel.org, linux-cris-kernel@axis.com, Lorenzo Stoakes , linux-rdma@vger.kernel.org, Mel Gorman , Dave Hansen , Hugh Dickins , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Michal Hocko , linux-ia64@vger.kernel.org, Paolo Bonzini , Andrew Morton , Linus Torvalds , linux-media@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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)