From patchwork Tue Apr 18 15:49:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13215861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8793C77B7E for ; Tue, 18 Apr 2023 15:49:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 625538E0007; Tue, 18 Apr 2023 11:49:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5AE1F8E0001; Tue, 18 Apr 2023 11:49:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44F0B8E0007; Tue, 18 Apr 2023 11:49:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 36D8A8E0001 for ; Tue, 18 Apr 2023 11:49:12 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 106E41A037B for ; Tue, 18 Apr 2023 15:49:12 +0000 (UTC) X-FDA: 80694945744.08.0C1EDF2 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by imf08.hostedemail.com (Postfix) with ESMTP id 249D0160019 for ; Tue, 18 Apr 2023 15:49:09 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=J+hC8F71; spf=pass (imf08.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.128.46 as permitted sender) smtp.mailfrom=lstoakes@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681832950; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=NPDSA+x4oz9imX3uiByE603i/j50qlmE+SnCawov5Gk=; b=ovu2Y4boOzffHh6Dy5QuGcMI8ndQ/1NrlQno1FSgxRWetki/+kOVpxRpMSSU79tOrP7HfG 1LTMaIskGAk0PLh7t9K7ehDYfcr4Bz04R7O0fUMI3qW1e+yHtEvT98QRiiwb8GB0haC8V+ jjAQ/uYD9IB+g+NWDdsIwNJhZFs9qcM= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=J+hC8F71; spf=pass (imf08.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.128.46 as permitted sender) smtp.mailfrom=lstoakes@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681832950; a=rsa-sha256; cv=none; b=FT7Zp7v5dIGcZdpFc8I6j8lxIHtPTVvVvbtctduYGNSRteSyvyjruqUgbwsOn9y4Okr2d5 dZNgoT0MnM9zPCVLECGo4kf5ZdECc5TU77B0x2WDvsR6Lcqb1yxLTHEcOFOxR+LQdcQ/0c bMT6XHuke/5PJp2egsa7ZoDc3h5g+48= Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-3f09b4a1584so18211225e9.2 for ; Tue, 18 Apr 2023 08:49:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681832948; x=1684424948; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NPDSA+x4oz9imX3uiByE603i/j50qlmE+SnCawov5Gk=; b=J+hC8F71kco8Juht/1xZ6HvwdaZ1yKC/66ZDQkDWwb6JRvwGxhNRTSXnHHz42bMO25 DmuRwo9hXxa4Kcc+fn0Bc7/oB557sS2XTIiHyGcE56cNznhhujRB3aVvEU0i/VqEHHSN 4QQBvP+edSPhv2Q/URS3BYuFpezdoIpB65jUr4OluO2ZqtdoK/GzsDzTDVHPTG+yfsLM UnejDVErRWK6ELXtmYEklX4B8FWPaFJvA4bkW48mkxb9pTwpbAO7dtiwxsqhXil0ddt+ fMBxrFS7p6BsoAX4kPiFEgZHEnWVhrX5x3Cprq2UOwpQyBDI2OPIJz4zPj/LDfgyljp9 CSLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681832948; x=1684424948; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NPDSA+x4oz9imX3uiByE603i/j50qlmE+SnCawov5Gk=; b=lG1qTce6JaN5I6p2HB4H3mCqzhbHjnbExgKln4G7PY2xXhZBIMB6QiFi1pcMPl7KK+ DvJo7I/fDR2IMVArvCIwVf45S9WOzVfXnTvk3WzwxOeZtWveExK3lfdXvIgucpQE5AVu ri5XsB0Du/4NcrZIiAHyrHg+cpKQTo4fDlfYy8d615lsNCiFPsaO+q87WLcRz2bOfUw0 ZUzFKt1/PrW439hhEzLjELfItlqRVbsisZUwKZ02gU79l8JifFKVClExYZ/yAJhPa1nu EmV08j3S8gaOMnS7Vj04c/YHXoMv2ufMctwVGraGQbxrKaBuuwfN5iTKtA4wRYdgUEm6 V3AA== X-Gm-Message-State: AAQBX9dZG+dyER9A1eYW1CdMv05DXCpQvmK+sn4gLqBN6PafMo/ybm6H d4dZr8MBmeHAaP2S20nwxYEXzcCROBYLrw== X-Google-Smtp-Source: AKy350YiLSJ7u9SiqFEKwv2I6butZKhidTn4j0OJ/5851Zru7xsHmoegW+XNWDQ016eO2V5AEiXTdQ== X-Received: by 2002:adf:dbce:0:b0:2f9:5841:a4d4 with SMTP id e14-20020adfdbce000000b002f95841a4d4mr2063234wrj.27.1681832948536; Tue, 18 Apr 2023 08:49:08 -0700 (PDT) Received: from lucifer.home (host86-156-84-164.range86-156.btcentralplus.com. [86.156.84.164]) by smtp.googlemail.com with ESMTPSA id p11-20020a5d458b000000b002efb31d3c24sm13352583wrq.32.2023.04.18.08.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 08:49:07 -0700 (PDT) From: Lorenzo Stoakes To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , iommu@lists.linux.dev Cc: Matthew Wilcox , David Hildenbrand , kvm@vger.kernel.org, Jason Gunthorpe , Kevin Tian , Joerg Roedel , Will Deacon , Robin Murphy , Alex Williamson , Lorenzo Stoakes , Jason Gunthorpe Subject: [PATCH v4 2/6] mm/gup: remove unused vmas parameter from pin_user_pages_remote() Date: Tue, 18 Apr 2023 16:49:05 +0100 Message-Id: X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 249D0160019 X-Stat-Signature: hbadmst48cohddc3gztguhpnawgw1x8o X-HE-Tag: 1681832949-5457 X-HE-Meta: U2FsdGVkX18Ze97sR4BAGEQbvosV+IZeK7jvip6QV951Ytmy37TfuR2GYTvmg2h++3K295Yup4nJpyl4RWytloDyoA0YyCv7j1dW4DMntSiBNB5tpDJIbCb8Q5yGd0yVX+QQM7RlajeGgikC013VQOEVWWwN5I05F5zG9QXjNR8HA1lo2Tp6a0WEibW8hUQQdBUhA4bWDDM6DGPXlCcrc/BoCrriVcmlOxt5EfQUjHh1itOCRhFvdZ2KDDbepqBK7iladsRFSGqJlcddVOrgSrppA6BTJSSe8rg96j14uKO9MiexVPvkypTr6+fczdPBAaduYsrp9CsnyAyKDmf1s1EuAcGbam0g4IPxVBpYd0Xdmx3r6KyqedyDVdlNRyAwY2lpHUezQ3B6Zwwb00zgy2qFgSQd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9Im1NYQs6uki9xmda/vYxEo3oII3jE6ispZdEma9uzAkjyun0cXzJEWE1HwXI+SL5BYv20mKwMEcCg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: No invocation of pin_user_pages_remote() uses the vmas parameter, so remove it. This forms part of a larger patch set eliminating the use of the vmas parameters altogether. Acked-by: David Hildenbrand Reviewed-by: Jason Gunthorpe Signed-off-by: Lorenzo Stoakes --- drivers/iommu/iommufd/pages.c | 4 ++-- drivers/vfio/vfio_iommu_type1.c | 2 +- include/linux/mm.h | 2 +- mm/gup.c | 8 +++----- mm/process_vm_access.c | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/iommufd/pages.c b/drivers/iommu/iommufd/pages.c index f8d92c9bb65b..9d55a2188a64 100644 --- a/drivers/iommu/iommufd/pages.c +++ b/drivers/iommu/iommufd/pages.c @@ -786,7 +786,7 @@ static int pfn_reader_user_pin(struct pfn_reader_user *user, user->locked = 1; } rc = pin_user_pages_remote(pages->source_mm, uptr, npages, - user->gup_flags, user->upages, NULL, + user->gup_flags, user->upages, &user->locked); } if (rc <= 0) { @@ -1787,7 +1787,7 @@ static int iopt_pages_rw_page(struct iopt_pages *pages, unsigned long index, rc = pin_user_pages_remote( pages->source_mm, (uintptr_t)(pages->uptr + index * PAGE_SIZE), 1, (flags & IOMMUFD_ACCESS_RW_WRITE) ? FOLL_WRITE : 0, &page, - NULL, NULL); + NULL); mmap_read_unlock(pages->source_mm); if (rc != 1) { if (WARN_ON(rc >= 0)) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 493c31de0edb..e6dc8fec3ed5 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -562,7 +562,7 @@ static int vaddr_get_pfns(struct mm_struct *mm, unsigned long vaddr, mmap_read_lock(mm); ret = pin_user_pages_remote(mm, vaddr, npages, flags | FOLL_LONGTERM, - pages, NULL, NULL); + pages, NULL); if (ret > 0) { int i; diff --git a/include/linux/mm.h b/include/linux/mm.h index b14cc4972d0b..ec9875c59f6d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2378,7 +2378,7 @@ long get_user_pages_remote(struct mm_struct *mm, long pin_user_pages_remote(struct mm_struct *mm, unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages, - struct vm_area_struct **vmas, int *locked); + int *locked); long get_user_pages(unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages); long pin_user_pages(unsigned long start, unsigned long nr_pages, diff --git a/mm/gup.c b/mm/gup.c index 7e454d6b157e..931c805bc32b 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -3093,8 +3093,6 @@ EXPORT_SYMBOL_GPL(pin_user_pages_fast); * @gup_flags: flags modifying lookup behaviour * @pages: array that receives pointers to the pages pinned. * Should be at least nr_pages long. - * @vmas: array of pointers to vmas corresponding to each page. - * Or NULL if the caller does not require them. * @locked: pointer to lock flag indicating whether lock is held and * subsequently whether VM_FAULT_RETRY functionality can be * utilised. Lock must initially be held. @@ -3109,14 +3107,14 @@ EXPORT_SYMBOL_GPL(pin_user_pages_fast); long pin_user_pages_remote(struct mm_struct *mm, unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages, - struct vm_area_struct **vmas, int *locked) + int *locked) { int local_locked = 1; - if (!is_valid_gup_args(pages, vmas, locked, &gup_flags, + if (!is_valid_gup_args(pages, NULL, locked, &gup_flags, FOLL_PIN | FOLL_TOUCH | FOLL_REMOTE)) return 0; - return __gup_longterm_locked(mm, start, nr_pages, pages, vmas, + return __gup_longterm_locked(mm, start, nr_pages, pages, NULL, locked ? locked : &local_locked, gup_flags); } diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c index 78dfaf9e8990..0523edab03a6 100644 --- a/mm/process_vm_access.c +++ b/mm/process_vm_access.c @@ -104,7 +104,7 @@ static int process_vm_rw_single_vec(unsigned long addr, mmap_read_lock(mm); pinned_pages = pin_user_pages_remote(mm, pa, pinned_pages, flags, process_pages, - NULL, &locked); + &locked); if (locked) mmap_read_unlock(mm); if (pinned_pages <= 0)