From patchwork Tue Jan 24 20:34:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13114776 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 C2DD3C54E94 for ; Tue, 24 Jan 2023 20:34:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F11C16B0071; Tue, 24 Jan 2023 15:34:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EC1426B0072; Tue, 24 Jan 2023 15:34:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D13E26B0073; Tue, 24 Jan 2023 15:34:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id AF99E6B0071 for ; Tue, 24 Jan 2023 15:34:40 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8552D1605FE for ; Tue, 24 Jan 2023 20:34:40 +0000 (UTC) X-FDA: 80390845920.08.FE68A52 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by imf12.hostedemail.com (Postfix) with ESMTP id C3C3E4000B for ; Tue, 24 Jan 2023 20:34:37 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=iB7+N5S2; spf=pass (imf12.hostedemail.com: domain of jgg@nvidia.com designates 40.107.236.41 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=1674592477; 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=Meg0lJjxcm1jvtu7lAs5qCLEBZuPFTvTPYQpefKTDP4=; b=7892Z+g15FWJQD/JHW8C5vNQdejgJTJp/V1bhuTz+NIuhVWQEAwxu9orBetjIrU1uB8OHv rJZBeUdJWh2IHMaDow3PmZTiH1T2zBDWPppfZAquTUbDAJDPnpDHfsmKjSFrkexBKXscyu msve6FLwE6KnoNgWaMlboR5hhnDWBj8= ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=iB7+N5S2; spf=pass (imf12.hostedemail.com: domain of jgg@nvidia.com designates 40.107.236.41 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=1674592477; a=rsa-sha256; cv=pass; b=LyrYWPx713sUw3Vq4Nr4kTUjS6HtHtyW+OmuvWr0PCRK0ArdJ47TnyPVhc9QFRotHj3J1K 0JrT37ClU8LSGKCXsIfI0jNmkujG766KgdIiRaHkHz68ZwETgDNQytB7jQRLbLmW5KaX4w MWgj+0otBf72bZOXW7ohcHpgzNckxNg= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MqQez8qlvVZINRF8QI7GGHrTToXVXg8bo/kOX1Ff1oj0XguI8g747TEIyUw/aHWd9Oel8Co2xZ1tlUQHnORs91/2ROW1EXnmmOE0LW/ybNjmHimdIY7064MMtEZUjCqTHxNBtll4S2YiP9LkGpzEJGQh1geZDrYIb2Gp6FV0Ol10cfQnLzXGU64Z5e85WclET+gI8qxfKiIYoHVaN5H0GWxUhSdBmx41hIdiDeYA1HMN2sDR9gTERfyHqMMidXBJMHOm9CQcjSQSNfTGMzIc/it6pvN9vUipXeDt7b8mxJiIIyENhkxSDeD8QqlQH5gUuOvE+x8MRyjkqr7Qjup1AQ== 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=Meg0lJjxcm1jvtu7lAs5qCLEBZuPFTvTPYQpefKTDP4=; b=YLiPQ9/j/lpVGiCfRDc5bAWr6HJNmZfOU0ENHLqHIF8XZBvwrttmJYxeFv+rVquSUTBIFSGtCn96kh4sMTwyhR2XvhAPsQ++cNSDGj+dcI8GCzWRxkKD9llhOWgHw9gURIdrde+IVyki29T4/cq01Nf9duZV71f0YCqsBuvGCaxwpo5lJIv6c44DM/rUxC6ir7TKYvXBCEVKddLwxlbubJwK6NXyCMZQH7+PtPcwKW0BuEfYCvZBuQsxHwdQ7Wcz2m6Mxt7w736nFeK2zQTh1llvOj7V3YRpbPUqNNT2w3xXD9tjDl+GcGPu+iAMMeishmwJG3rStxS9D1gNV4FFaQ== 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=Meg0lJjxcm1jvtu7lAs5qCLEBZuPFTvTPYQpefKTDP4=; b=iB7+N5S2gBouyX1w2JsI35SXJREEvUzYbRXrjLRHZBtEn9pEPQXoCUi2roXpEko+8n1aFhpwoqQK32PVGOduYfT2HSOjvLZYyPEEnPPKHNR+5lFlf0KWEIP2b1iPqjzPSk2Kv62mXsQxjd1oxp72FcOY3uxNYqTBEQ8V8Sx3hiFqYIoaE2z8flm/Hms+qRL9slvV12EUVI4hVDONSQ+P96m+AhCxzqGBxCT4TXyDLDGkSEKIwUhpuOOAz9EsP0hsVp20oGe6K7Fcw2XUxMqxuH1gUMQ3sW/T5r7W3S8JDYNabVyUmdIFS5Ubl1pwaOLEZixC2XeBHQbfkFXI0IFYnA== 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:35 +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:35 +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 04/13] mm/gup: move try_grab_page() to mm/internal.h Date: Tue, 24 Jan 2023 16:34:25 -0400 Message-Id: <4-v2-987e91b59705+36b-gup_tidy_jgg@nvidia.com> In-Reply-To: <0-v2-987e91b59705+36b-gup_tidy_jgg@nvidia.com> References: X-ClientProxiedBy: BL0PR02CA0003.namprd02.prod.outlook.com (2603:10b6:207:3c::16) 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: fd2a6b75-948b-4e06-a249-08dafe4a67f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g4t4XlXLUaaON/kUSJ9aPKnbGV9Wq3OYrslAPtDZIytisyX8NxefccaAmF9qbLbzDPqrDlmc49uhZrncSosPGK6vF+bf6MHfX0AfJxWBOMr8FCOmkNk9mfNZ/Rvz7Ghbnnf4yIZKzds0G0IZdH+bAHqNlIBpnM9ATwp1rwdU6HUb7+Z5GZV9FjUjyZtDTWRA5O3HqFPq9t3g3w35ilqxfeDZ4xyb6j41jGznR0cDCYxqKgqzF9kp8ynuBsf95+gR98EOiZnZzeBzkwSmwk0UOO76xR+ii9lDyNwWvL2jt9DRv3KKHCd0imRPavP6fTQ3vIEXw06fImz4ABsgFoZL72KybuZ4Y+m7ZPUSFHsgY+sXV1zq+pFFMR18oukBScHjZqr0JWsVTNwFbJPN6Ld5E8X5VfKrn2/MWA1T19NAa7RRuyGl+TP6PQfM4LRoC2Ou7KX/TlBa0RjKf2OjXUNRG4jIpDIyOi72ddZ36F5MWJLnuCqaOh8ef1bXwEaH8FGHI2hODmd/7BwQDiOeNDNCsO4RMx00HqanjRI5UAdBaJGibUrlXnQJTIKOmYfn8E6sHgdeSXAUEVAS2yf5sar9kmirXAHP+Asvw7dwq/Sl1c1uq8qTLrDB8tTHrJe194kVDEbi8868jTLEM/+sc+XbChkmE0eXAuO38O6ab3KhVF3d/7ja2aew6PiY0sSd1zFSaU2kvK9z+cyiojAvVZrb7A== 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)(4216001)(266003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m82yTrxOaCC/49WbSowqTKna6AcMzSraM/7fQ00RM4bzsjwARqUj+p+yzHwA2uOV2R9P+zRzXYeJMsm1jnXPyQ7na6SVDM2rviZ3vzXqznK7kD6Dw9wmATNFTPvYT3eNFDpCCIhCAOMn596FuXWBi7YPoBewvgF7JXcuXArl0JTTu2inEdSbLmSaC8zfKBywBFWr1G7n4QV0mlcw1pzuOVSp/YOsSJLCXrCTHnHU5oHSxpLeQqFz7dpn/eFI0sN05Z1KXyZ/4VYONWzCJcxgnLpuknUEmV7ed1YkqUsZhoma+47Srx2pxz27XdaYzwF+JZD2oLcPm/Hx1CRKMebqx3CnczCWfk5SZFMVmHvoShcFPcgMvoKtIw5Bz2Y2h3pDXOTt9wn0dT21fRFbsuVIXSSH9fvVK8OkDkQdNxCDWJ0f5g4kmOUoJYPYHc5e/3/GDcoIt90reHRb1FpmbHHdGriymoxbDRbeUQpkWx1zj/gBWn81I1lbQW/Mipyo1xsmAMDrTLOLQfPuHwcLYxfT65V0ETjZuWnp+YS6T0SZekphfX/yslKsUQ4iPs/X8UaZ6xCRP+VvYyn43ODHU/C/NHOiU/5Iz1ZFDrtXue2lv810zSj8iBtGsP9rwHjWYdvC/pTL0PgWWz/YKX7hYkzgX6aauZ7PkxcwH7irNfojYx+m1FFVO9rFpBzlccJqvHUuWbR0tI+Aihvow4OevNeIkeuvX864keZahYTWagiAGz+kNfYcW+VpQjXr+u/wZP6/zPMzyRk7BmwqbyFvEI8KAqERQbWYudnL72ZLtYWriminvxq+5en6faOsP0MM3VJq7/IZiODnRaWorprIZBQb//vZSQDUhrMBThIDNWglGwOQdYQehYMz8loMhtOsSGIiMAO0JML6WBWl0//jygL94lXWXqkbJuufyBS1XxsGl/AKJemhAvrUHcUJUAAH/uevjcfeYhezwt+ZFpaNes0lHdjoGRznGD9aDYd872GeR16wCDASsaqXApmpL5PgsuKmvmL/l1xoRUJhlZipfk63zkRdwJQYY9KM+CM+DdDukpa5NsSuPw6wXk3knp3/YynjaWw3+PLGbOLR0J2alGstuhxyHkCztTYcIRcaA0jKmYB8ziRyejNcgyDdYKyZDP3NGsDwgxJhhFKkv60VRL/+iZodAkeNSpKa04Zm8l1GaBzmAFmngeJHGaup5EpeG2wMlFBsdrocrlsRZYKbCWsvtZ2KBT1BdtS5cCkIAq4vh8JM4xwn7qpEdMYfawDAou7QSX8cEXCXIA/1uPt+IWXhvLQuViXb+57rrMvBGEwElwkog4EXL3K0+RZtQLU8c5vKFb+3rpQsSHWUFOnbYrVgFqLFlORxbP7QBwSvIcUOgHL5mlJHXbjluGWSa25IqZ9HzGXgJvUJVb4lzHwFcly5kGeQRPqJQWjhUbakHgf3iPdUvTkQBmOQsCUvcQQDkG1W5f1bC8Aleq0QSGR0Or2TzKDnDln9TUs1IYfy5plSaJBVpLVwDC0YpKrqMmBKBELecxGxDGk9Gxq7i7HqdJQ3qlVCGVwaDY1ImLa1Q7m1c2Ph7x+ed3rSFLtecMsZNtyQ X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd2a6b75-948b-4e06-a249-08dafe4a67f6 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.2827 (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: nXhOu4Y9aaYh6oCZyu/7w3hPeh0jApcF8iwBPT/rybBrHiD/1zYQyo5fivhqxWXU X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4095 X-Rspam-User: X-R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z1kfuT/iI EEYsBZIg VURmEub64gop4/IWuBLdbB/gxwIg8VrbP2JHKgmXlXb36mKwNav+X4c4Drm/3lIgcKAA0xdUtoSxiPFpmKO/jRNoS4JRu5WvCIh92dLs4GiozOGLNerFW8Dug7/RrwUHaNGWUWWSdM7B7rldHo4dMMydirXUJGiNvWJaNECnxpA6veMDx+jFYTGYZaSxn7BVxruyvUvLNiUOv6IMOxE2jdCa9nevkXUzeEiTyA5grN6cc10nmHrabiuyVW40tFL856t5en7CiKnH5BHFvz3FWUKdQhrXVXeBt55/I 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 is part of the internal function of gup.c and is only non-static so that the parts of gup.c in the huge_memory.c and hugetlb.c can call it. Put it in internal.h beside the similarly purposed try_grab_folio() Signed-off-by: Jason Gunthorpe Reviewed-by: John Hubbard Reviewed-by: David Hildenbrand --- include/linux/mm.h | 2 -- mm/internal.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index c9db257f09b307..dfc2a88bc4a8ed 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1173,8 +1173,6 @@ static inline void get_page(struct page *page) folio_get(page_folio(page)); } -int __must_check try_grab_page(struct page *page, unsigned int flags); - static inline __must_check bool try_get_page(struct page *page) { page = compound_head(page); diff --git a/mm/internal.h b/mm/internal.h index ce462bf145b441..0f035bcaf133f5 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -852,6 +852,7 @@ int migrate_device_coherent_page(struct page *page); * mm/gup.c */ 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); extern bool mirrored_kernelcore;