From patchwork Tue Jan 17 15:58:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13104841 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 884FFC677F1 for ; Tue, 17 Jan 2023 15:58:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 827BB6B007B; Tue, 17 Jan 2023 10:58:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B12B6B007D; Tue, 17 Jan 2023 10:58:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 602ED6B007E; Tue, 17 Jan 2023 10:58:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 4319F6B007D for ; Tue, 17 Jan 2023 10:58:53 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 126051A0615 for ; Tue, 17 Jan 2023 15:58:53 +0000 (UTC) X-FDA: 80364749346.09.7723190 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by imf09.hostedemail.com (Postfix) with ESMTP id 46E10140003 for ; Tue, 17 Jan 2023 15:58:50 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=miKlORK8; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf09.hostedemail.com: domain of jgg@nvidia.com designates 40.107.236.40 as permitted sender) smtp.mailfrom=jgg@nvidia.com; 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=1673971130; 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=vjkJ4CJY5l+CpLD2RdwgUCctGewL3b0/B+3EzpvAOKA=; b=tj/oqWjMlflf+CPQ+zUqZbd8Kj00gMxJj4ZtF4++59dJACAqziG6t9tYloH/MKF9Dl41Jl 6w2CdGg7heJwjI2zdAjmjRJDAZB3zm+jiBrGQ8bLOMrgIwjC+zo/2bXcQmHSNOQr12j4OL g8zUtjEmzqY/ACmQcpZjSZy7bO4frbM= ARC-Authentication-Results: i=2; imf09.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=miKlORK8; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf09.hostedemail.com: domain of jgg@nvidia.com designates 40.107.236.40 as permitted sender) smtp.mailfrom=jgg@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1673971130; a=rsa-sha256; cv=pass; b=D/SM50F7bwhhxJc9TToFRL1Pye4aaH9H3KUVbK87R4GVe7UPu5wmFC/9V5gT4i8fpMbEhU LJp7ekRZaBMKsLpQMRThHYKkiWWvrS4kEPjdcz1AvynywqlK1coXpR7YTDd8bs3rY+H6UM Y0ZSRDCkmASk44tkgiF6nQVrq8gQMZA= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KLZVmfBNkstqRPWi1vw9vGK8oDAVTYqsAuzrssnZux5amZdXzvEX2miO6mEo/l+eBDG/pY+ZBIRaTtC73fIpn1RGQ8wnbhvJb9zc1P/prcAAe/rRcMZjQi9Y2t0sij8ZeI9vrKLwpVGWiIvG8ZG7Vd7o6T5tNWVTgcfO4OdtZogH9Mhy6+GfOh2wEnLiqrLj9DcLbslCya2ror9FSHNctzGPB9fgcR39xOoMWi8b7a6QH3qXP/WC5UOEKAoRnfL9W5Hyqc4dyhqkO7objPXm+UhMPlGEU3pV9SM5mpRLHXNS4C7T3O0MkKaGOV/wkl4M1hiQyiys0AEi7EDldU1yIQ== 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=vjkJ4CJY5l+CpLD2RdwgUCctGewL3b0/B+3EzpvAOKA=; b=OySUAHuakPJOwE/aT22HlR7HCfKFJeWZZYriUbpPUnqRh62+zb7WhqyDbKLGITDQ3aR5HC34/xkq95NPtgQ1VZswJIuljdUMiQMZFB3U/1Fxv4vedyPVNoPdPrY2b1sL52DjwrF1+OVqknihXXAtV8TMBt1jpcRiRzyo2B/GX7SpsgStdlXFBzPdpTbNTl7f9/p//N5OM7UUTzsFz+h7Wmqy8ReYQD9h1yayrRQNetxZHNPKfmy/q5LSKB3ohFU7nyoirCwclKl3dklCpTd8DOzlCal2wBsJIhbV2MywMqbSKNH6VFwCTqhpSVzGTWBMNewVQgcH7Zvb47meLis0Hg== 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=vjkJ4CJY5l+CpLD2RdwgUCctGewL3b0/B+3EzpvAOKA=; b=miKlORK8j9l1sJxEItte2pdG0sQmkwSffR9pY65/JnxXugf3Tn7JPnpz9dtTVO7gJ3ZtevQFkzfaf16KQ7Rb8XDojpEhf8Bqb2HzB0DUcuFif0Ry8Zm9qFHX8hyDcJBvCDFGbJyGgVKHG2/2UCHpLhT59bPxP01Vj539gFcxlUcnwK6fmOYnwrI7MTml1Ml0HWz3CtN3YbPRbY+TZV7hWHIF4lG/ranTDY07fDP+ccDJpq+hIZyWRxNSRUpq05jAfmLUmVjIM0xvZpVjKU7cSVm39Wp/Fdt8Et4i3LhVSXv3An5nJ6FgBNOUavt+gawvofMvLcD3T7w0sA9neWtbbg== Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by IA1PR12MB8334.namprd12.prod.outlook.com (2603:10b6:208:3ff::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Tue, 17 Jan 2023 15:58:41 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f8b0:df13:5f8d:12a]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f8b0:df13:5f8d:12a%9]) with mapi id 15.20.6002.013; Tue, 17 Jan 2023 15:58:41 +0000 From: Jason Gunthorpe To: Cc: Alistair Popple , John Hubbard , linux-mm@kvack.org Subject: [PATCH 2/8] mm/gup: don't call __gup_longterm_locked() if FOLL_LONGTERM cannot be set Date: Tue, 17 Jan 2023 11:58:33 -0400 Message-Id: <2-v1-dd94f8f0d5ad+716-gup_tidy_jgg@nvidia.com> In-Reply-To: <0-v1-dd94f8f0d5ad+716-gup_tidy_jgg@nvidia.com> References: X-ClientProxiedBy: BN9P221CA0013.NAMP221.PROD.OUTLOOK.COM (2603:10b6:408:10a::6) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|IA1PR12MB8334:EE_ X-MS-Office365-Filtering-Correlation-Id: 721c3584-e34b-45d1-679f-08daf8a3b434 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J8oeinBDx25F++/z2Ic9cLvO6e7gxluYmOt1CsZuPsw3xOcx+X4c/S1rl+PR69zLO6/CP+J1ur9PhVfGx22RaGcCdcZAHyNyUJFPqMV6mvm56yPzhAuc16rnKzzZVG7JExmzdNviWKm7C7I3ZV3dqHCC2dLkxD885yCl/uzFpam+eE7Nn4V0mzecqFxUPLN4XO+bQCIPkxuOMfq1xJjMVo2BPxZes5LMoYm8i4AG4Hr3/F/gi/SsIrkMu5SEGe4WlISWy1Ekv8Czl0fbS7dLBx8jqzds3Qw1oAA3Dqoqkwm5DKeAONarHWElhVI9oSyyaNk2/49IYBHPl7QlotaA9F56CEGJhZqjlOuXReoMjZiEZJLJoxt9AAfchoJwbU6e/7h+tQmRgOJCrpu6eOD1+RDKc13+P49ZIbFQS6U68u1BjVyD01IYyh90Sq+pTyKnYfp5mI2V+mpW/OX71q/++LowaScKcVeBZ6UpJyvU5nyoUaIESdL1tnkhaWoeju6YmjOU1T04GFVwM5AqC4yIIlfXK09d7X05QpVwkq7g1wkg6OQjG2MnOLqLwoRSMsuVw81ACXmRQugkOakZXGcRjke/f1UVkQl+/UwNT1RGdToFMTUgbJG5denAQwN+zaIyIlCIqYHcGhOAn1fmOgwt0t1pNLXKQKrhofA2M2wO49qpCo1VM8P+D+3Qwsj8rnBzXp2MCnLjwBAsEjM6Z0GchQ== 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)(366004)(346002)(136003)(376002)(39860400002)(109986013)(451199015)(36756003)(86362001)(2616005)(66556008)(4326008)(26005)(8676002)(6512007)(186003)(66946007)(66476007)(41300700001)(83380400001)(6666004)(6506007)(316002)(54906003)(478600001)(2906002)(6486002)(38100700002)(8936002)(5660300002)(4216001)(266003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Hd/KdpFUnp8Gw0TG/w3+sd4b5SuKpqTEs2aPWPP6pPkdghT36N/xHXkWzMq5+BwI+JHIJ7atM9H5H8RPR0dVzxMZtPe0rTjIl4CdSqtYl/+GsJ2g5BLvKmDCWLaXQB45JMzi7zOLOb2ptQ0Y7bXAFchElS0MdR4fELC8JEcgG1uX/uvFqlWSyiKfj7kGm24uvE77QuUOAC/cmjbuqnenjA9xyLCSHtKoqRwY8H7bBn358ljUuNEEHq7Un3fiCj0aTFmOHofRd/SBgSTkOu9qO4gENOdHms/Lr+9VRk/FAJARLnxdwlysxuh8lgnXyqtwvh/XXV/eWJA23a7bYgTewOu8m/WKCfcMCCOWnqHw9TG1QBqImboSXxIKcgLmUdD1iGqw7NMEZxrS1N4grxCEhc+4dm1G/CBsqgF2UAGVMu5ZTnNUFVJKF3506Xiy/tiv09RjmX8wvU5Nuo74od34YCJDD54w9HKmG6H+3LqVs51ChSU8mcgZxWb2nDP+JiUahcodw1bdZL//PX0wl0Vf73K0ALiE2yfXbpIjQBcW8tT9uN8PO8UOlVEmIxVWmh56hbNzaO24B7Q X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 721c3584-e34b-45d1-679f-08daf8a3b434 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2023 15:58:41.4287 (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: wc1UgINiLELvSsCi7ajrbjSzgwWEYVHaAdCKOnnPVJMMZpeZt5Hd5cYPX2e/dE9E X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8334 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: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cKfsAuajFx10qZiagoFfV1CiF9jmqbUpuLz 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 Signed-off-by: Jason Gunthorpe Reviewed-by: John Hubbard --- mm/gup.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 3a9f764165f50b..2c833f862d0354 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2188,8 +2188,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); @@ -2226,8 +2226,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); @@ -2251,8 +2251,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);