From patchwork Wed Nov 16 20:07:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13045714 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 CC021C4332F for ; Wed, 16 Nov 2022 20:07:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E058E8E0001; Wed, 16 Nov 2022 15:07:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DB5256B0073; Wed, 16 Nov 2022 15:07:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C55EF8E0001; Wed, 16 Nov 2022 15:07:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B759F6B0071 for ; Wed, 16 Nov 2022 15:07:17 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8758F160205 for ; Wed, 16 Nov 2022 20:07:17 +0000 (UTC) X-FDA: 80140389714.06.9B85AF2 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2055.outbound.protection.outlook.com [40.107.244.55]) by imf22.hostedemail.com (Postfix) with ESMTP id 56E47C0011 for ; Wed, 16 Nov 2022 20:07:15 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KoeflHlsjNbIOBCkVXHl91o5fF4LMU2USONCgkIHnSvajI2NOb2sfe7yisbq+lpqoAoD75T0g7J5Ng48/yL04Mnz7Agz7NOmBJDCS6MeltwxhXYBVHmsUvTd6138mwib0Xf43/Nfu1J/dnJmrnHXtyn+GL7ZCs8gL68HCfTuSKECwjW5PI+C7rItAUge2xcYLkd9AyJXJlARCpr1T61txoFRTV3iPgDmBgQx/8+3TSqyUVRk2NEU6vCO48JUi1gVTgaf3hEFFWS0Z7QQcaDGsapZon2gJb4wpcsdiu14MuEIyvAYOoByw44QD46G5zRe02Iq5te11lG1dGd9FZuHAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1r7AkVkpVz4oFJjayJUvTe59HIVema0B1teSaXDEl6w=; b=k+jmG8smOMDkYI+8axd6F9rLsyE3Fm4P6m5DKh/kLfiLeXUFOR+oGH4FS0zltI9zBHCZ/yOjyzgcm+yj/J4za7lHANf/fCRY9UisJpGpJ0grVNYYsLJDLH5LRl39NXptalzLiEZJGTdLOIjoZ0wNHvXES0eCM12YGG3+r6zmyYayUQvMwkNx8PQzfBjOljg6PVnRa1CG+h5GZYMf4IxaOhMMzn4ecyQD6/9pTwjfDrTPWF8gR+2aF5D9lNQ9hK81SmC186SnUx8Fc+CX2ED03huJ7hWtTlwXK+pJBV+yd0fUsL9roUiGDrMkA1R7TrAyWAEkW6gSRRaZMZpu6puXBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1r7AkVkpVz4oFJjayJUvTe59HIVema0B1teSaXDEl6w=; b=BwyIUBXLUVQajGJwfUcuU/aEJ2U7QSoWeWXf4qMetOWrobDBvX0Qh3wus8FlEuMzEqjRAbBKU1ztiGoUmrm5g0ZSX+Za6+vX0nxAxF2SnRfpNetqP6v+oiPWBJT4gPM1H3DDq+PP+UZcE7uGQuu+LgKbwv2qMgErGmQncbyvCU2txqmOUzPGL5eWjcioEqa5dT2jTwpAvvxnhNXfOFiSqOO/pI36NzDRxlNqkx0oN5EzM+1iTMxBXIT/xyGmCy05TIiHVKsOIY5x91G+6fIi8SdubIWWIP6jjoWpbvbXanyjvGHDD04EdZOaos/Jykl5Rp0LLM/bS464F/BZ9ErghA== Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by DM4PR12MB6256.namprd12.prod.outlook.com (2603:10b6:8:a3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.17; Wed, 16 Nov 2022 20:07:12 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f8b0:df13:5f8d:12a]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f8b0:df13:5f8d:12a%7]) with mapi id 15.20.5813.017; Wed, 16 Nov 2022 20:07:11 +0000 From: Jason Gunthorpe To: Andrew Morton , linux-mm@kvack.org, John Hubbard , Alistair Popple Subject: [PATCH] mm/gup: Remove the restriction on locked with FOLL_LONGTERM Date: Wed, 16 Nov 2022 16:07:09 -0400 Message-Id: <0-v1-b9ae39aa8884+14dbb-gup_longterm_locked_jgg@nvidia.com> X-ClientProxiedBy: CH0PR03CA0228.namprd03.prod.outlook.com (2603:10b6:610:e7::23) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|DM4PR12MB6256:EE_ X-MS-Office365-Filtering-Correlation-Id: 18e947e7-3acb-4f76-8077-08dac80e252c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cfnirb14ngf3FIgd0kuycryJ98rDTolGB/+3CkrzCA/1ll9ao2NJiqzHuQ9lad5Kj7xQl57mcnUtA0b/Cp3MGjvOeRsrtddnTgMeiAmrlPK5+kg1TPZmwm2aO6z0LFR6URh2u/PGS0pQmR6qXmeb3+f+ON/WUexCDhr7nSSlBmnKKIcUJaNUtOr78XdhCDHhfYIIwDP1kbdJsu6m0g3S2Nxh5yxImw9z4CA5PN6X5FCLlKbZ1QVWb/iSaSp1FPyJsq2Ashu3oRzo/RQbmHi8GWn+4nWgV5PW1Ta+D8CHIRgjkanQVmF5qFpU9gpr9KTARZgdPJpg/i1cv4Rj7ldH76XBiAQSU+CPvrZfoFsdA7NSveJXW2HeP5mSg/VFNegQxJ5wiSPSIjQLD6pDq8cLKOVDtb56Ms2v/XW/JKIFzEJEQHdtsoh8+C7gSBQ/NbVpYnmuyub4MRhvEbJ2syB0eImbq6dGEXvbYfJggzOHninrWejiDAUfJmN9q7+t6glO4YxdjZaFILXQsmHCNKhJn/4hrjBWtfbVUC9i/8LSR+yayxeVQ3n0NjZ6HGvrx73W1oxMbvePWk6T/GZQvsqQpIpNPoJY2jOv+lA6wNW9HjQUtg5sppBF0f9lxwGhtZe2xKuv/i4EDKgcEykIUc0cJeCD20qWyL+aIId6WYT4qRuLR7XgagXyxr9mBCivdZ2Ij/2M9PilOmudicD6IWx2/+MlC5eTvAGZWO9oOq1UoC4rpK4MaTp5xg7egKulG4Ey X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(346002)(136003)(39860400002)(366004)(376002)(451199015)(36756003)(6512007)(5660300002)(83380400001)(26005)(38100700002)(186003)(2906002)(8936002)(86362001)(41300700001)(478600001)(6486002)(2616005)(6506007)(66556008)(66946007)(110136005)(6636002)(66476007)(316002)(8676002)(4216001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gR7PAjw+wuaPba+VgRDVdJ1RyS1er05oDdC59RDCVsMf+mc9Ff7Occl4huGqMHuT/YccK6GP1jBilnMT2Ml0PQ9pVfdOZQmeM8o3HcTqTLWGogDCdo7AHnJK1G462E6mAFxLV4StOb1nrn90EM6FEraeFf+H+WqF5ibKK4lTSIkBx2178oArAK6wMJIJ6/DKKYvvnVZICoUZs5Nz1+V0waCnH8k4bPUe8RqmsOfORUTa4NcPfztYidjrUZrOmFPAL47nmHZ/63jiqfUEStkhUMUHhLiWQ8n4mUcO8p5Kov57fwlbcyRdxC5aCdtJAHVq2zaP03FzYgn6+QedxPLG8X2v22CBD2ia27/N56mIReFTR/gBg49uxSUGP1SjFqSsYhgeSipTSXZsQfM/X9rXSF+W98GS0GbxrdxOblYwlORCwFu+2pw7xJlDEmS6yDntnzNqaxy37fJwXTstGa0nzPfm0haMS+ipQLLjZr4AqT+2xAVWeHXSL6vPx1/yR3m8O7kNXAkVY2fpIESXtShPScS8ufaIx4Bg1tiwpWB54kelIwPQtRb6p/ucNhXFIGicnnsiG2ieJ2BONgk+wG4kTrDku5qJPrVSG+pwfcQ5kUnkN4pMf3ORYgjtHEMRFJieCbMaa2hCOPFkQXZ1yT58BpFLmMWra6J87QK6SLZ/WUyJzKwWPva0oVD9hC+Tz5ZT5Z/pNMEpwAvE0FMdXXH+LjBOWSuBJia1rzI253v3MUhTwyQzD1TXCGeLVVDUPNPybX6O429PORGzatChilDM5d0/qMy3Ymz+weSTECMVh3OQ413HIZnR7rlTXb0A/mWa/XifS1zFic/5i9/Y0s76Mt9CfCUEp69WfKLg4DJD4YihpQGv2YNjtRMf59K22P/df12mNZVf3fG2QRqPmuvJfzY8zZkVc+xQtuWheiqnLUxBDIQHpbDjRlTrA/+BPudSzRaAavFFG+1neN5H+wPLDnggf1ESzDsi6LBJnnDXQde9bmJkPQy/bdyoLI6FZtrDB+U+Jr77y7u4oTiSwsNTC/U2lkUkxUeiVu+C4MTmC1JIcEvsBAWrpZL3yDturvJIpokT8MtBIhgnqgf5JJXS9lMJNfbaJ+D8TnnzKVaLWf2wi28v4HiM1kRrkkHk3JwQP97aYNUkK/VVdK0zfBX2ulLQaOvlxgurmDvP5dkDDLmzEeZOWW0/+FcFyd9YzKUXl59oukYdedJoi7dM603KL9v/fqn4wqgEQQW3vm9eaGpUbFet0JkO1AsGkqYOiwU+UzIs5vm4dLlh+yVTJcgx/zte4dpNN9Fbz/jINbm03/osgfommYOqeezySbo7H1pAijHNgERqGMrjrca3UzTiW35MfsPC0VjY3VVdpAkR6t86qDGv1ml+61cRll0ZOi6loNzK7aOWwq/a23DStSrcFTyneF5cQkhebomY+enHfG5bGCJdwR+AIXku2xCA/8RdZfBGrnlts1guHaKuLzuaGe9tH2/StpL9wrfs2ifNbHJyvqlHMsbsrKht0aX1++sNUtw252gtKWh9FuWclKZMlBhBVW/yt5lnOQvP1O6AUhjqFhQNdfL9Iv4h0JvkILwI X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18e947e7-3acb-4f76-8077-08dac80e252c X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2022 20:07:11.9190 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GJPuGXQOVCkKRQYrYBYNwaupWpUCYf+mmNQcadAXM79TIlAN6wDas6KsraJnYfdW X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6256 ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1668629237; a=rsa-sha256; cv=pass; b=z1Gjffk36sOaCvHl0P++SskxMysR8h203AUDUm7O6hwO00BMUW+H5F8ZAO/1/dErRi6RDx /iMUBVFSQaeBWZQdhfFwHEsYBh7UQSunR9vPP97ev85h4vEOG/qNuACCAUrLUwVjefxiz5 2+Bq2rhnaU12BPyYlPfj7GYK8Sa/bWU= ARC-Authentication-Results: i=2; imf22.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=BwyIUBXL; spf=pass (imf22.hostedemail.com: domain of jgg@nvidia.com designates 40.107.244.55 as permitted sender) smtp.mailfrom=jgg@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668629237; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=1r7AkVkpVz4oFJjayJUvTe59HIVema0B1teSaXDEl6w=; b=HWyBr0eZvAQF+klPs1QihhqdQ0YbwIA66d1ADtcLpCIG0YdEf3CVTumKn15Zs1qckUOdfn t6BX3NGfh4mqvGFTygF3K5BgbncgWgkgU9OhTkvcSP1+NFiown2XQjYE7xalk3q56sX1oO 8VglJ+1dkcYC/uc/iC8KJkmBWTNPIkc= X-Stat-Signature: ietfsoc5oemos1eepf88swtky9nkrhn6 X-Rspamd-Queue-Id: 56E47C0011 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=BwyIUBXL; spf=pass (imf22.hostedemail.com: domain of jgg@nvidia.com designates 40.107.244.55 as permitted sender) smtp.mailfrom=jgg@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspamd-Server: rspam04 X-Rspam-User: X-HE-Tag: 1668629235-602661 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: This restriction was created because FOLL_LONGTERM used to scan the vma list, so it could not tolerate becoming unlocked. That was fixed in commit 52650c8b466b ("mm/gup: remove the vma allocation from gup_longterm_locked()") and the restriction on !vma was removed. However, the locked restriction remained, even though it isn't necessary anymore. Adjust __gup_longterm_locked() so it can handle the mmap_read_lock() becoming unlocked while it is looping for migration. Migration does not require the mmap_read_sem because it is only handling struct pages. If we had to unlock then ensure the whole thing returns unlocked. Remove __get_user_pages_remote() and __gup_longterm_unlocked(). These cases can now just directly call other functions. Signed-off-by: Jason Gunthorpe Reviewed-by: John Hubbard --- mm/gup.c | 109 ++++++++++++++----------------------------------------- 1 file changed, 27 insertions(+), 82 deletions(-) base-commit: b1a4dd7dab677fa4bfc4967c99ee45ba4d1d05d6 diff --git a/mm/gup.c b/mm/gup.c index fe195d47de74a7..91251291698a08 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2105,14 +2105,19 @@ static long __gup_longterm_locked(struct mm_struct *mm, unsigned long nr_pages, struct page **pages, struct vm_area_struct **vmas, + int *locked, unsigned int gup_flags) { + bool must_unlock = false; unsigned int flags; long rc, nr_pinned_pages; + if (locked && WARN_ON_ONCE(!*locked)) + return -EINVAL; + if (!(gup_flags & FOLL_LONGTERM)) return __get_user_pages_locked(mm, start, nr_pages, pages, vmas, - NULL, gup_flags); + locked, gup_flags); /* * If we get to this point then FOLL_LONGTERM is set, and FOLL_LONGTERM @@ -2126,8 +2131,13 @@ static long __gup_longterm_locked(struct mm_struct *mm, return -EINVAL; flags = memalloc_pin_save(); do { + if (locked && !*locked) { + mmap_read_lock(mm); + must_unlock = true; + *locked = 1; + } nr_pinned_pages = __get_user_pages_locked(mm, start, nr_pages, - pages, vmas, NULL, + pages, vmas, locked, gup_flags); if (nr_pinned_pages <= 0) { rc = nr_pinned_pages; @@ -2137,6 +2147,10 @@ static long __gup_longterm_locked(struct mm_struct *mm, } while (rc == -EAGAIN); memalloc_pin_restore(flags); + if (locked && *locked && must_unlock) { + mmap_read_unlock(mm); + *locked = 0; + } return rc ? rc : nr_pinned_pages; } @@ -2160,35 +2174,6 @@ static bool is_valid_gup_flags(unsigned int gup_flags) } #ifdef CONFIG_MMU -static long __get_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) -{ - /* - * Parts of FOLL_LONGTERM behavior are incompatible with - * FAULT_FLAG_ALLOW_RETRY because of the FS DAX check requirement on - * vmas. However, this only comes up if locked is set, and there are - * callers that do request FOLL_LONGTERM, but do not set locked. So, - * allow what we can. - */ - if (gup_flags & FOLL_LONGTERM) { - if (WARN_ON_ONCE(locked)) - return -EINVAL; - /* - * This will check the vmas (even if our vmas arg is NULL) - * and return -ENOTSUPP if DAX isn't allowed in this case: - */ - return __gup_longterm_locked(mm, start, nr_pages, pages, - vmas, gup_flags | FOLL_TOUCH | - FOLL_REMOTE); - } - - return __get_user_pages_locked(mm, start, nr_pages, pages, vmas, - locked, - gup_flags | FOLL_TOUCH | FOLL_REMOTE); -} - /** * get_user_pages_remote() - pin user pages in memory * @mm: mm_struct of target mm @@ -2257,8 +2242,8 @@ long get_user_pages_remote(struct mm_struct *mm, if (!is_valid_gup_flags(gup_flags)) return -EINVAL; - return __get_user_pages_remote(mm, start, nr_pages, gup_flags, - pages, vmas, locked); + return __gup_longterm_locked(mm, start, nr_pages, pages, vmas, locked, + gup_flags | FOLL_TOUCH | FOLL_REMOTE); } EXPORT_SYMBOL(get_user_pages_remote); @@ -2270,14 +2255,6 @@ long get_user_pages_remote(struct mm_struct *mm, { return 0; } - -static long __get_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) -{ - return 0; -} #endif /* !CONFIG_MMU */ /** @@ -2304,7 +2281,7 @@ long get_user_pages(unsigned long start, unsigned long nr_pages, return -EINVAL; return __gup_longterm_locked(current->mm, start, nr_pages, - pages, vmas, gup_flags | FOLL_TOUCH); + pages, vmas, NULL, gup_flags | FOLL_TOUCH); } EXPORT_SYMBOL(get_user_pages); @@ -2330,18 +2307,9 @@ long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, int locked = 1; long ret; - /* - * FIXME: Current FOLL_LONGTERM behavior is incompatible with - * FAULT_FLAG_ALLOW_RETRY because of the FS DAX check requirement on - * vmas. As there are no users of this flag in this call we simply - * disallow this option for now. - */ - if (WARN_ON_ONCE(gup_flags & FOLL_LONGTERM)) - return -EINVAL; - mmap_read_lock(mm); - ret = __get_user_pages_locked(mm, start, nr_pages, pages, NULL, - &locked, gup_flags | FOLL_TOUCH); + ret = __gup_longterm_locked(mm, start, nr_pages, pages, NULL, &locked, + gup_flags | FOLL_TOUCH); if (locked) mmap_read_unlock(mm); return ret; @@ -2935,29 +2903,6 @@ static bool gup_fast_permitted(unsigned long start, unsigned long end) } #endif -static int __gup_longterm_unlocked(unsigned long start, int nr_pages, - unsigned int gup_flags, struct page **pages) -{ - int ret; - - /* - * FIXME: FOLL_LONGTERM does not work with - * get_user_pages_unlocked() (see comments in that function) - */ - if (gup_flags & FOLL_LONGTERM) { - mmap_read_lock(current->mm); - ret = __gup_longterm_locked(current->mm, - start, nr_pages, - pages, NULL, gup_flags); - mmap_read_unlock(current->mm); - } else { - ret = get_user_pages_unlocked(start, nr_pages, - pages, gup_flags); - } - - return ret; -} - static unsigned long lockless_pages_from_mm(unsigned long start, unsigned long end, unsigned int gup_flags, @@ -3041,8 +2986,8 @@ static int internal_get_user_pages_fast(unsigned long start, /* Slow path: try to get the remaining pages with get_user_pages */ start += nr_pinned << PAGE_SHIFT; pages += nr_pinned; - ret = __gup_longterm_unlocked(start, nr_pages - nr_pinned, gup_flags, - pages); + ret = get_user_pages_unlocked(start, nr_pages - nr_pinned, pages, + gup_flags); if (ret < 0) { /* * The caller has to unpin the pages we already pinned so @@ -3241,9 +3186,9 @@ long pin_user_pages_remote(struct mm_struct *mm, if (WARN_ON_ONCE(!pages)) return -EINVAL; - gup_flags |= FOLL_PIN; - return __get_user_pages_remote(mm, start, nr_pages, gup_flags, - pages, vmas, locked); + return __gup_longterm_locked(mm, start, nr_pages, pages, vmas, locked, + gup_flags | FOLL_PIN | FOLL_TOUCH | + FOLL_REMOTE); } EXPORT_SYMBOL(pin_user_pages_remote); @@ -3277,7 +3222,7 @@ long pin_user_pages(unsigned long start, unsigned long nr_pages, gup_flags |= FOLL_PIN; return __gup_longterm_locked(current->mm, start, nr_pages, - pages, vmas, gup_flags); + pages, vmas, NULL, gup_flags); } EXPORT_SYMBOL(pin_user_pages);