From patchwork Tue Jan 24 20:34:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13114787 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 8A632C54E94 for ; Tue, 24 Jan 2023 20:35:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1B6F26B0083; Tue, 24 Jan 2023 15:34:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 099BF6B0088; Tue, 24 Jan 2023 15:34:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C50296B0085; Tue, 24 Jan 2023 15:34:54 -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 AE6AA6B0083 for ; Tue, 24 Jan 2023 15:34:54 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 86CF980366 for ; Tue, 24 Jan 2023 20:34:54 +0000 (UTC) X-FDA: 80390846508.10.EF751EE Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2056.outbound.protection.outlook.com [40.107.100.56]) by imf28.hostedemail.com (Postfix) with ESMTP id D4574C0003 for ; Tue, 24 Jan 2023 20:34:51 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=CI82frt0; spf=pass (imf28.hostedemail.com: domain of jgg@nvidia.com designates 40.107.100.56 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=1674592491; 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=n9QOZ0CxPutgVlVGahnDR92oM8ovpkJvVl6oiKzGidk=; b=1CI43n5wPfcoq/M3p+Nfng50e+++Hp47WhH2kSLiGw2CRPcm+8GPdYavrUO7BxXu37MZul mRLSFjGlHY46JYX1d+bw3h5viA/lqHHNZVO6zZiHVzuKPi954duhJpYzA3JuqqzGCC8JfW lJ3w6+qi7z76tk5yp1nHnWU5STcS5+8= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=CI82frt0; spf=pass (imf28.hostedemail.com: domain of jgg@nvidia.com designates 40.107.100.56 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=1674592491; a=rsa-sha256; cv=pass; b=rF5bcnPylH3/MpqrN0cy4INX0c/PJE3xFXE40blGkIthzm2gO2R7Ep3CARKDcvqsSpmKuw wFw/2/QXGgx+/ZlAGbxQU8izVqrqjCj7N0zR0+pQ3xV1kEcXbPXnhL24ZQcMjtNKaIxOaK ww4hkoNsG1GNjqJjlQszcdVby+o5UkY= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SFnAFp8DpSHEvdZ3aWVy3r6MuMsM2DEccP0ftSnfamaoTfyRlIzCbv6JTMTWu/13hOD3vVh42YHlU3qWhuJr7ssWHDRXMLTKvYnxVSk2crFj9EgVyXPHTLcIdVs0kN2r8CrwQFoR8KU29QjZVwiXiflDyMKHLGSS++nzonIF+zekbr1jEcpObOrdlJNOnQei0GDKmq3Pnqb4RUwHuRgSALjkeFqnkb0drDIE3BHXlqY+mzyRb8WhmO5xCfr3/2rNLiE+z7qeAGQGBQpH98AgtQhn1JWqCgt8guxpwvHcZ7yG+ud7SPWxgxYRaC3XlqohsY1V2lIv/MQPXUbjYU5mRQ== 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=n9QOZ0CxPutgVlVGahnDR92oM8ovpkJvVl6oiKzGidk=; b=FUCs5djVdYodUUwHWafGV0HG5b2HjmFlreaTTj9u7AsNIEAGkd/Ey2Q8N3UauoT3uS5UbHQd7PUEcx2jMXjogOtbDqZFh7IFiKldWavXgfpGXEw03HY2snp1afZmHLxzrHD3B2W9SVoER1oxj5knSmR9/tkFOxrqayyPWEkyt8vyPYdhiH7SHa2qKTLtu8HOX5WbCYCalgLDzpxKf8XfPgNCMYAf8NHl/Fg9Dl/emvivTIKcUtVEVQb9WdIdhxun4VMxiEJ+j5ZeNqJiFUwQCaFZ2l1uZBni/m1nMUXlfV9YEZrpq/4BXhPn19n/8V90rGhVU9jifWwSk2S4d68gRg== 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=n9QOZ0CxPutgVlVGahnDR92oM8ovpkJvVl6oiKzGidk=; b=CI82frt0aIIrREjfIOMdE1WBFlQdvvCbQTWy/OOt3nEv+q28nb0WZQ9R1NQ2qaRkLEanM2EOqVvyrMxM4/YZO2IpGiEDmRR4U7sh5HPm9d5FYq5JtezAKV6Pyh27m3hey28vtgYRe3LxUaVSoaO/kmA0xymZuvHEPxs4To7eTOa1sMws80BbzpWphT4mNHogVqH0tBTG+2GnF/W1YdxOnOURf7zn6rKwG3WwW+xvo+IBdtjDEXSI34gtHXUykOz2281xrH1mhwBXKJ7QsewDDLzF+hBKAjJxP77rp4vPi0pbYkOhqOI/u+PmQ8nnQvh2Z7ImH7A1LIUTZZ24ZbiNHQ== Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by MN2PR12MB4095.namprd12.prod.outlook.com (2603:10b6:208:1d1::11) 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:38 +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:38 +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 13/13] mm/gup: move private gup FOLL_ flags to internal.h Date: Tue, 24 Jan 2023 16:34:34 -0400 Message-Id: <13-v2-987e91b59705+36b-gup_tidy_jgg@nvidia.com> In-Reply-To: <0-v2-987e91b59705+36b-gup_tidy_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR20CA0037.namprd20.prod.outlook.com (2603:10b6:208:235::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_|MN2PR12MB4095:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d1125d9-04cb-45c5-ad4d-08dafe4a6855 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D0MsqKPXI7k+eVZzgQfRev9+20Tdlp1skF3M5nawoWVOdt1zAbrfmNahq3eHcsqLc7sMwGzC9/gkRA3MQttq71DQZ5mFcDvV4zD2hb3qKmOVZNW+CQzOF7pHtXI3Wfdg76Ylq/AcINI2BO/OzeIe3x5G3McwqJfHSO9o4hP73L042CXE0Twu7ygIwKOvMxN92mkr3yq06lbA2PpUnEkitMVJ6iUNr+Y0qJQCBqeDmN1JKLchd4/aMMfIwJeILjPYjXRzrFElqHM+E4cTkfleq5ZVwZn+gjs71Xt0pFI3/xFIa1Vq5PQhCu1qdRqAM+fZGEZm0ZIGk5FpPS7/3pkFvBKSzgf5Ek6aeMtFFvo3VmPtB96j9iW65Z4ZK5EdT5PWykLOFGoUsas+/aqDo3//ittnGOIDA7XTH/oGR4JIOyMLu5nQGQxyxyHqLif3QDq+uPeK+0u9VZaX4vXlf6apwU8D1evjBzaba7lG7G6pNNhvDbb+i2pivbP8mN2PtaJl7K0oaKK1FlFKSbx279CegY0sJuQh2Uu7VXHSt1SN7XnYU/CSFSo44zSbqgGz2lu6TMMKQKOsYqxM2FBnmUWMg3v3lrM3Oimk8m65dRN+Y2w+/XneVObEKfSdMa+k9LWDrlriYT5GyKNs30qGXL64ltWNoO12a4mxRILi2DVcc2BP5+laUPOA5BZk9Ko2qYyv 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)(366004)(396003)(39860400002)(376002)(346002)(136003)(451199018)(109986016)(38100700002)(83380400001)(5660300002)(41300700001)(86362001)(2906002)(26005)(4326008)(8936002)(316002)(6666004)(6512007)(6506007)(8676002)(186003)(66476007)(66556008)(54906003)(2616005)(478600001)(6486002)(36756003)(66946007)(266003);DIR:OUT;SFP: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LtAAjWWVC/K07RwaoLPso80m1DFez5cMLYJCEnLwpgSYTLBVbHrbef3JlDjUywzkFNoLaD80Dda+TJKHOEbIy49bOP/S7xLFlI70qJTrB6T6mJwH+unw+2b1QC4bF0VOf84QE9aj7PEs95fQQVSJs6JNPvVKkqPUhhULuBDfNayRO4FDNuEen1X7HYh9NBLIa7oGjz2scaGpUokR/Rht4KFTdEdrM8N/IKr8/5kg7tKPJL0JL8QaYWXtxtg1sedQxBJVq+oBG3mpGRg9UaocXSr2/jxviraMkf/PQCsGrzaIfAqFQYCmAlCSxOBea98p3IRghJmjNHHM+KTop0Mzna4YxVYLDY8j9nh9cKlLRU0m9gd0F84CE9zra31EKfelcY8tSbk7LYIbUXA/mA0JStWDElrE8mAa38PlmA6CtZlDsM5wg8ZLAYLTnvT53YJ4A4DKXEQdtPDbTvbDrjww/bHc/o0OwOophceszQ6do2G++nX/Iroyd/3ZctND8tHu3unzY/DJY9keRYymIc7U19L0gi/wXSWK2ripfW26yrVU2ojF9kHNVwxIIukgCfOIY X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d1125d9-04cb-45c5-ad4d-08dafe4a6855 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:35.9388 (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: KO1HqhyektUW69SIVn3WYG+mT4yMNPwoXQiEOrDBvAvy7mgPvlAqpjHX9JPFbf93 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4095 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D4574C0003 X-Stat-Signature: 96fo4y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q2x7ryD8DEH6TVs49shmqylB67zp9oJ+1eyjwXcC4pfojtiNfBFuYo6haIpfW1ZoswOSiK3aVkD6U2Sb6JXN2OZToy8IFWF5qsoz4TysYBkVxAMm7Dd9w+bFdgffbSQFVu4+T/kPTc+pe43zGzN5F7KAnAZ2S/TnJ6C+vaNzP2OyBbIuh8hKmYPZmOPbbvJ6Iy4p45QsS2mSBbc3ZU/OLTDdfZaUbKbCqimI/EkrLEBTno00usViw3rfK+LQQV9HS+w5tYMsyFEtXGr8mY9+rZimp+cNvdeinzHzJI42yct4ce6ZMXWowY13ut/VJ2QdzZNA8eJalf2YiVHFIPVRCg== 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: Move the flags that should not/are not used outside gup.c and related into mm/internal.h to discourage driver abuse. To make this more maintainable going forward compact the two FOLL ranges with new bit numbers from 0 to 11 and 16 to 21, using shifts so it is explict. Switch to an enum so the whole thing is easier to read. Cc: David Howells Cc: Christoph Hellwig Signed-off-by: Jason Gunthorpe Reviewed-by: John Hubbard Acked-by: David Hildenbrand --- include/linux/mm_types.h | 57 ++++++++++++++++++++++++---------------- mm/internal.h | 15 +++++++++++ 2 files changed, 50 insertions(+), 22 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 518617431f8085..dbfc3a7e9559b4 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -1039,9 +1039,6 @@ typedef unsigned int __bitwise zap_flags_t; * FOLL_PIN and FOLL_LONGTERM may be used in various combinations with each * other. Here is what they mean, and how to use them: * - * FOLL_LONGTERM indicates that the page will be held for an indefinite time - * period _often_ under userspace control. This is in contrast to - * iov_iter_get_pages(), whose usages are transient. * * FIXME: For pages which are part of a filesystem, mappings are subject to the * lifetime enforced by the filesystem and we need guarantees that longterm @@ -1085,24 +1082,40 @@ typedef unsigned int __bitwise zap_flags_t; * Please see Documentation/core-api/pin_user_pages.rst for more information. */ -#define FOLL_WRITE 0x01 /* check pte is writable */ -#define FOLL_TOUCH 0x02 /* mark page accessed */ -#define FOLL_GET 0x04 /* do get_page on page */ -#define FOLL_DUMP 0x08 /* give error on hole if it would be zero */ -#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */ -#define FOLL_NOWAIT 0x20 /* if a disk transfer is needed, start the IO - * and return without waiting upon it */ -#define FOLL_NOFAULT 0x80 /* do not fault in pages */ -#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ -#define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */ -#define FOLL_REMOTE 0x2000 /* we are working on non-current tsk/mm */ -#define FOLL_ANON 0x8000 /* don't do file mappings */ -#define FOLL_LONGTERM 0x10000 /* mapping lifetime is indefinite: see below */ -#define FOLL_SPLIT_PMD 0x20000 /* split huge pmd before returning */ -#define FOLL_PIN 0x40000 /* pages must be released via unpin_user_page */ -#define FOLL_FAST_ONLY 0x80000 /* gup_fast: prevent fall-back to slow gup */ -#define FOLL_PCI_P2PDMA 0x100000 /* allow returning PCI P2PDMA pages */ -#define FOLL_INTERRUPTIBLE 0x200000 /* allow interrupts from generic signals */ -#define FOLL_UNLOCKABLE 0x400000 /* allow unlocking the mmap lock (internal only) */ +enum { + /* check pte is writable */ + FOLL_WRITE = 1 << 0, + /* do get_page on page */ + FOLL_GET = 1 << 1, + /* give error on hole if it would be zero */ + FOLL_DUMP = 1 << 2, + /* get_user_pages read/write w/o permission */ + FOLL_FORCE = 1 << 3, + /* + * if a disk transfer is needed, start the IO and return without waiting + * upon it + */ + FOLL_NOWAIT = 1 << 4, + /* do not fault in pages */ + FOLL_NOFAULT = 1 << 5, + /* check page is hwpoisoned */ + FOLL_HWPOISON = 1 << 6, + /* don't do file mappings */ + FOLL_ANON = 1 << 7, + /* + * FOLL_LONGTERM indicates that the page will be held for an indefinite + * time period _often_ under userspace control. This is in contrast to + * iov_iter_get_pages(), whose usages are transient. + */ + FOLL_LONGTERM = 1 << 8, + /* split huge pmd before returning */ + FOLL_SPLIT_PMD = 1 << 9, + /* allow returning PCI P2PDMA pages */ + FOLL_PCI_P2PDMA = 1 << 10, + /* allow interrupts from generic signals */ + FOLL_INTERRUPTIBLE = 1 << 11, + + /* See also internal only FOLL flags in mm/internal.h */ +}; #endif /* _LINUX_MM_TYPES_H */ diff --git a/mm/internal.h b/mm/internal.h index 5c1310b98db64d..673b4b1d5f4c79 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -854,6 +854,21 @@ int migrate_device_coherent_page(struct page *page); struct folio *try_grab_folio(struct page *page, int refs, unsigned int flags); int __must_check try_grab_page(struct page *page, unsigned int flags); +enum { + /* mark page accessed */ + FOLL_TOUCH = 1 << 16, + /* a retry, previous pass started an IO */ + FOLL_TRIED = 1 << 17, + /* we are working on non-current tsk/mm */ + FOLL_REMOTE = 1 << 18, + /* pages must be released via unpin_user_page */ + FOLL_PIN = 1 << 19, + /* gup_fast: prevent fall-back to slow gup */ + FOLL_FAST_ONLY = 1 << 20, + /* allow unlocking the mmap lock */ + FOLL_UNLOCKABLE = 1 << 21, +}; + /* * Indicates for which pages that are write-protected in the page table, * whether GUP has to trigger unsharing via FAULT_FLAG_UNSHARE such that the