From patchwork Tue Jan 24 20:34:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13114781 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 57100C61D97 for ; Tue, 24 Jan 2023 20:34:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63A536B0078; Tue, 24 Jan 2023 15:34:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5263E6B007D; Tue, 24 Jan 2023 15:34:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3781F6B007E; Tue, 24 Jan 2023 15:34:47 -0500 (EST) 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 1AB0B6B0078 for ; Tue, 24 Jan 2023 15:34:47 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CD4161C648A for ; Tue, 24 Jan 2023 20:34:46 +0000 (UTC) X-FDA: 80390846172.14.6FC0E0C Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2044.outbound.protection.outlook.com [40.107.243.44]) by imf04.hostedemail.com (Postfix) with ESMTP id 0E63C40021 for ; Tue, 24 Jan 2023 20:34:43 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="fF61EZo/"; spf=pass (imf04.hostedemail.com: domain of jgg@nvidia.com designates 40.107.243.44 as permitted sender) smtp.mailfrom=jgg@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674592484; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6C1mPyrOdOAKQZxg0z4XyWJ1Fbd0rMj+97/SFfFOIz0=; b=qzoHiDTieqhcD6S0IxvmxfTmWNicu9BI1YPgxZPOGZswk6/ntS48KL8xwkPHiBkk5cEhrw +Nep1FAQUPSoAOoaon2oqDtWPWoxI0d3lASNNluIEDkQNMv3/3HBwhsasBK3L4jzwrOuPs MNbtZPe0v/xu657IqprzoTqWE2BQCpM= ARC-Authentication-Results: i=2; imf04.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="fF61EZo/"; spf=pass (imf04.hostedemail.com: domain of jgg@nvidia.com designates 40.107.243.44 as permitted sender) smtp.mailfrom=jgg@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1674592484; a=rsa-sha256; cv=pass; b=svH2IRPYJ70Q3dNP/AT84b6VDCsnLwt2E+X0ymCDi1AKbSJCL6MK1l8sf7SX0dYlErGOJt 34lORZtzAJNFjUu/tWpUZTuKpNJt21xxjkxDttCK7uLmxyOn77xT6mFFI2bwjybjgoptnf efSk9vLjQphkB9l3xNguV8TWDaujxi0= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OW9pUOObOCKnVnSxNFauQZHh7FRFVrqFRfPvCioapvJH8VJfKttMb+3WU4k+f96NiUfQHZt+lEyxQr4camS3JZaM/X7JprSTjBQaYEk6eDzsRND0JIfynX/dI6MyMxoHroHHbit1YyIUWOKFolNk83LxYGLCEIjrXCcN3vLCL/UZ3sOUp+EJjegh+cP6x+jCP75BVq3Vl9qcnSaUVEJVpNqP3Wa3RWqu7ogWBWc+FDyr/Qa1GqDp4/VFwZohwudV1AXDeKipKU8yfhsDpkJcPyW4WBFHmRn/RzSc/83g25RXzlwvX2hgFv4QjOzOE6zWOMZclq2Nhfx/8i4XNolNag== 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=6C1mPyrOdOAKQZxg0z4XyWJ1Fbd0rMj+97/SFfFOIz0=; b=TwdbSwXCxPkdxqRieeHWgwt47B+p9SwDDKATPmbRdbitNjyPKWv0OBvXO0z/xKJBdOBeTvUxverYIN3F1mqdnJI3MVRlydKZUCQObzVLK2rUqiWoU5DFfSxDSwBIdx2GVDGlhWTsZpcOVDe6ejQ4cmPvxBMlHBdDnxL2Vk4IU3Vzq0kb7jtYs1ENO8LbxnaOXVDNfhXoPnD/NdPIFuUWJMJDBfimwk3aHauVHssbAA/k3Ebx1pZx4R9vvK8xVaGyobPGPV22Gdou9bvOG7a7PTyca830z/It2j6q+GTILmWAYCvDFClGJMQwrB6BvTus2sIRvsT8XKi/Q/ihXKahcw== 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=6C1mPyrOdOAKQZxg0z4XyWJ1Fbd0rMj+97/SFfFOIz0=; b=fF61EZo/ogO2gcz7DNSgE2vWJ3eKoi04N7HsZusmjv/FqiskcctNoJDMlMqZhp6/azeeA1a97CCD4vZm2p2YsgwzyNyeityqLmk+XRnyF3/rV9tCFPZXrG2NKJlGMwlB0YasyVX4dUbPvRfuUbVKIOpN/WlCgOwjfRKlDTtzn+pWJ5JL/6pM1F5nF/ojMZuet2U1U3etWq5kCTtwy+tb+fmvPS75ALv3dbEe6LMkexdOy0PKze7DU4OHBlOhisBkp6y/kLHLwpndvT2j33yLy2dbSOtOsZYsMlK2T18zUw1qztDQ7JbHFKQUPBvgcw8NXua5ttlRgSSZem+Z7Yl/eg== Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by DM6PR12MB4220.namprd12.prod.outlook.com (2603:10b6:5:21d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Tue, 24 Jan 2023 20:34:42 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::3cb3:2fce:5c8f:82ee]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::3cb3:2fce:5c8f:82ee%4]) with mapi id 15.20.6002.033; Tue, 24 Jan 2023 20:34:41 +0000 From: Jason Gunthorpe To: Cc: Alistair Popple , David Hildenbrand , David Howells , Christoph Hellwig , John Hubbard , linux-mm@kvack.org, "Mike Rapoport (IBM)" Subject: [PATCH v2 03/13] mm/gup: don't call __gup_longterm_locked() if FOLL_LONGTERM cannot be set Date: Tue, 24 Jan 2023 16:34:24 -0400 Message-Id: <3-v2-987e91b59705+36b-gup_tidy_jgg@nvidia.com> In-Reply-To: <0-v2-987e91b59705+36b-gup_tidy_jgg@nvidia.com> References: X-ClientProxiedBy: BL0PR02CA0083.namprd02.prod.outlook.com (2603:10b6:208:51::24) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|DM6PR12MB4220:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d528839-b74e-4b3a-1ce5-08dafe4a6b91 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i3eb+yND73QcALSRSkoFeHhUsoXuGyIs16vyXFOnLzFl0HU2yfskP1XbvdAWCga5zjmm2FN3F7vRg7w0IldgdZfCu5mwf2KHWyMYZ0oiU0u9cdFJ/KdN+q1LpJ/ixPiEreKWQc71QOAiqOHhX7BJNJJqACxWzGVDOrcfSLW60WHzmI1aMXFsexY/k+9LIJHALeOXgg0nrqB4i0y6t0pfBLvlFrDuQSaV5Kqv1I8v9YeN4zgSAAlz4YgsTO4VX+Wkf5jxazKn/9bt5ZUnqOAL20dFmUY+kLsl6ksZP260U87cqN9hPVPDP3n8lMDZxMonFJBTeVQiUQ/gMzuZf1hhqJWZdSIIxleLShAqATBKxkvxQ8A6o34tW1Nt5L+MHJUu17KtetJISQk6vnMD60HGfdvebH+Vs4gpcOmqESB4UCEQiEDERz3DFDr9sctTH2bQ7W4OAr8hTNL4ynk+FAVl5NO0i7rtxBk8ubwFunq+qPIJmb0clDj8FtaJ4umtomOWLjNbMuXUYya0AXWwa+vpaE3HYYh3hiMttUkT5WYe6oJZ7+xdN9iw4hFcbhU32IfD769vK3RFBxqq4fgP0ufIyWXivgiYFOmucqZUaN/UX5nWzCszmHQ35lBw8l7exuHR2dTpBzTsN4kk+nY8RGCZv0VYNNVxCUTYh72OSo1Y4TUJy35xLhD6VJRdHJVPdYvVQvJNcXIrYCd/y51yBc+yHg== 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:(13230025)(4636009)(346002)(366004)(39860400002)(136003)(396003)(376002)(451199018)(109986016)(38100700002)(36756003)(66556008)(316002)(478600001)(66476007)(8676002)(6486002)(2906002)(4326008)(2616005)(54906003)(41300700001)(6506007)(86362001)(83380400001)(6666004)(6512007)(66946007)(26005)(186003)(8936002)(5660300002)(4216001)(266003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8kPWPq+zKmZgIS1+rPWInt9rPLFJpHrtUq6fwgbMxlg370DGjAkfGOCp41Ijz1PTVwYpECd3sqmgg9VzEv7HCDfKWU9kskMdNLICAPMJH7aj+NykRz5Vi4BvaKjzlZMqGybroaohN5+DYgu66QcGf9APOlOWspIDVVJ8L/JRgAyKWNIJPSRD5DyBdA0L5V+PxByU6h1Ex1YS+UTGOhOKD4G28m9fesyWwkj8rBRilGg2DQrNm48UAIJNcCZRzezRD2UcZyj7gr3MVTFFJfOENtiKSVlIxmq280IpBivCMFe3F8XdekWuTSs1j/LEMgGTrLEjoLQFZxRGWRUL+DPgWuImZ9tvjZ3Drq6tLxBumYJau4aY5eUKpmkjvXeQ/LYBFMjed4AjvhdFfvkdXG30BNojRHhyVOzVR16GQ5pgT7Kw7f1iphUsHzdJRn+iYJ8dNftqubqa7n21tyU+srpz+Ro7B5RE74pjHhVu5CbbjTdPDDWUYNY92IFwPGjpWI1lr8GNVa1UBew9nPNB2l+R41HDcAVe1dcITZ4MTZMOHnV9o8F9fD7dfRO+FFAs+HEe8v7tdCg6fpKygN4+tiP6k997pn9irPh8Tq5gqph9v3lagg40c+ybA+fsWpdHxgnkrUqQAi+tHZfGSTZg/ABrV3Yoblad5FiJQrgG26L7kDDh7qgtYBR0iezIOyVGR4zroDrjfj76RVlS40PzMgq2lpYFEHVSKX80J1vCb4/zfFeC5YqlIiZ/uCx/1N+UYBCpp/CFlD2L3zJc2NnczZd0lGrSEZvajrBXpfbcaiUUBjkknd08V6ZuUYaQiWw50t/0AG5S2f7Yj5Yb/ga89/sputBUBmSBqbiU8qr5nRVt6PF989x3CPHHZ0NKgUBSm9iX0iBbmaMoswCw5rG+kbUHxN4GI1wuEhjyRUFs/XBL+aJMCPB/OOEf3K82kZ/boqV+BUDij+IGflRIgvOCGIH6ZLsjqyDc+X/XyzMveae7IY6INNGfNV/ErFHv8qG/wWE8G1M9m+lNp51oDIUnnDvG1yueR56qm5ZM9qL2UEO+2zJ+5nwW9jNNRQHObAWrkA7rwWv6GEusBGAfG06kXVUJ3lWyBEyVouaNku0+DRDWH5M8Qu/qMTenBecS0/nw1NBTuaOn4WfJMy50Pwz4sUErll5xDVyeGnOwW0a80bP+wD2U/3+aQIznUdCsdlGaBhbWvzvaoX51+DDU8CR3n2KUJY1lInHAPfDVfax9w71e4NZlmMwq1MXqjHiS9IBrgVePReHXMTs8MZ9VUINUrNXyjaNrWy2+lKWe+wzLkpwCwVFDsxovlzQuhuFhLTWUgGz/PeFqruSsrwRXn5MS6oioHl1+0IaGuGzbGaYoA+vj2IGFvHJG9ZiKwvVsDAmT5oA10y6MWcv8Cte2VoS0pjgxiDJbrcxoBPF59R0yFTJWrvgwZ11tdjLSP6JzydUoaXVqxT04zZLb+Pggh5F7WBjmI93sYk/ftVPBnXI0YDPcrkkxrV8dBUJE912kOBNbO8deaYO786BVUyhhaxJcPO6zR3tqZbthD4+GLqLu12uyjprxrMps2j7v07BydOELStEF X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d528839-b74e-4b3a-1ce5-08dafe4a6b91 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 20:34:41.3303 (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: 6E2Qug/TBlAPF/tLnNbdo+6p7qB/YHt8mTDHOs6MbCciQQakt5wL87UjbeiBH/GX X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4220 X-Rspam-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Nhx7/nHDoPSp xObQUwzP PzqCMsa+EBoS/rBBbIzUZn8RUU7b5PWsZLMHNMtIcLqIG+rYgQ4Ps54fHSxaQWoiQqQ4cSLXUqNq8QVSDuMLWrbXrICva+rSPWcW0ccwM3gz+NNDawzUmcMXfZlA4k1tBHr3bCRw2Og5mKcqyMKreIevl+Pb5MxnADE25fp+YQDVsZ1Q/vx065vhPBxuUld6CvB16TWjvs72Txf5yYZf/Qoyn4xC5/vbywx8cAxLWcF+aSQaHCp6fv+Tw22IlaRZp/LaCEEdQCBLBDo1+2L5JBH3VHPdTSu1q968HnYgfqR8Kh69obyyAuqBiLvfiTl9WThpA/nwFtrGdNTILMG5JIxnapA== 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: get_user_pages_remote(), get_user_pages_unlocked() and get_user_pages() are never called with FOLL_LONGTERM, so directly call __get_user_pages_locked() The next patch will add an assertion for this. Suggested-by: John Hubbard Reviewed-by: John Hubbard Acked-by: Mike Rapoport (IBM) Signed-off-by: Jason Gunthorpe Reviewed-by: David Hildenbrand --- mm/gup.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 7007b3afc4fda8..a6559d7243db92 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2200,8 +2200,8 @@ long get_user_pages_remote(struct mm_struct *mm, if (!is_valid_gup_flags(gup_flags)) return -EINVAL; - return __gup_longterm_locked(mm, start, nr_pages, pages, vmas, locked, - gup_flags | FOLL_TOUCH | FOLL_REMOTE); + return __get_user_pages_locked(mm, start, nr_pages, pages, vmas, locked, + gup_flags | FOLL_TOUCH | FOLL_REMOTE); } EXPORT_SYMBOL(get_user_pages_remote); @@ -2238,8 +2238,8 @@ long get_user_pages(unsigned long start, unsigned long nr_pages, if (!is_valid_gup_flags(gup_flags)) return -EINVAL; - return __gup_longterm_locked(current->mm, start, nr_pages, - pages, vmas, NULL, gup_flags | FOLL_TOUCH); + return __get_user_pages_locked(current->mm, start, nr_pages, pages, + vmas, NULL, gup_flags | FOLL_TOUCH); } EXPORT_SYMBOL(get_user_pages); @@ -2263,8 +2263,8 @@ long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, { int locked = 0; - return __gup_longterm_locked(current->mm, start, nr_pages, pages, NULL, - &locked, gup_flags | FOLL_TOUCH); + return __get_user_pages_locked(current->mm, start, nr_pages, pages, + NULL, &locked, gup_flags | FOLL_TOUCH); } EXPORT_SYMBOL(get_user_pages_unlocked);