From patchwork Sat Jul 17 19:21:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sierra Guiza, Alejandro (Alex)" X-Patchwork-Id: 12383833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AACAC6377A for ; Sat, 17 Jul 2021 19:22:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 96BF161167 for ; Sat, 17 Jul 2021 19:22:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96BF161167 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6BA078D00FA; Sat, 17 Jul 2021 15:22:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 668008D00F5; Sat, 17 Jul 2021 15:22:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E32B8D00FA; Sat, 17 Jul 2021 15:22:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0233.hostedemail.com [216.40.44.233]) by kanga.kvack.org (Postfix) with ESMTP id 206998D00F5 for ; Sat, 17 Jul 2021 15:22:02 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DA48922ADF for ; Sat, 17 Jul 2021 19:22:00 +0000 (UTC) X-FDA: 78373050000.21.AB1AB62 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2088.outbound.protection.outlook.com [40.107.212.88]) by imf26.hostedemail.com (Postfix) with ESMTP id E9C57200170B for ; Sat, 17 Jul 2021 19:21:58 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j9quswX2DBRwiXDgu9rth8gN254M5xItIezkgfaCom42j+4Xsp+VCRM3qzUl3WtIMbac3TS3F+HVmtUslPPzHH/my00MAJnxx2NSBrk7+Ii9mvkBYP+6+34r6enWZ1fQ8lbKCQNYYbqLZVlIZltaZzgeYA+JVDw75+EVP3Lhd7HjvBSnmjwLHWOW65hva8+6VKkOa/ID1h/erRv5QGw8Sof1a95IUi2TflBnY/Ys7H8avwewPtrNYiMf9/Ih56fzpGnShLNI557O1gXtALLr5eNJx/fEvC2hfebKBGgFA2L7Nqm0rHDYinjtcQy9G2XdVyMWxo8oYiyZp1cIIuUL8w== 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-SenderADCheck; bh=t+7nKyjfyLOZihYvp28L3Imk5sdJ3gBsKhRXrSh/IuI=; b=T5+Qx+8FCnVBL27ueApHrxDbzVRXxP7PuF1lpIMnm3ByXCZr3weoTuG29EvfmBS/xfZDEoPbo5MkDnIXoz0F2LbfexGW9h4hQ5xVvM43Ah8UOoM+0m41Z+Y/fDXiIiLdxpyJ8rZMnxAOcEhhNmLAj5TvZk64yB6ZKo7UXFH2cQ5suoLaUdj+SWIE9M3KDxMIFVBMc7Zr7TMAPNLHz5T7sXDMkXKl3QYo9593d7TcNz6DA6gHPlRLORy5N0rmtyeF9qAe1A5nior1oOW7INUU0V1MeIDDg+e3TqToxFrBfLs9UGKveBb/LVK38NMhLuDjY3p2X9dbAlhy90YBbq/NGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t+7nKyjfyLOZihYvp28L3Imk5sdJ3gBsKhRXrSh/IuI=; b=IAYivu5vasuPFgW3f42ExlAvjIyQXs6eZ94zvAfpLWdtOhQKXdE4AAE5qZOsW6NUuyN3vW2SFgOM+pTCfKW1yYjsqouVxs8LXf/QrfAmPyLdBGBfC3/HLf3se3KMeX+occZGkGwe3GzzEFXXztXXtlhA5/jUldRwyu2Hi0ikVBY= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SN6PR12MB4670.namprd12.prod.outlook.com (2603:10b6:805:11::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.22; Sat, 17 Jul 2021 19:21:56 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::d0d3:a97e:6b7f:ab39]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::d0d3:a97e:6b7f:ab39%7]) with mapi id 15.20.4331.029; Sat, 17 Jul 2021 19:21:56 +0000 From: Alex Sierra To: akpm@linux-foundation.org, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jgg@nvidia.com, jglisse@redhat.com Subject: [PATCH v4 06/13] include/linux/mm.h: helpers to check zone device generic type Date: Sat, 17 Jul 2021 14:21:28 -0500 Message-Id: <20210717192135.9030-7-alex.sierra@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210717192135.9030-1-alex.sierra@amd.com> References: <20210717192135.9030-1-alex.sierra@amd.com> X-ClientProxiedBy: SN4PR0201CA0067.namprd02.prod.outlook.com (2603:10b6:803:20::29) To SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from alex-MS-7B09.amd.com (165.204.78.1) by SN4PR0201CA0067.namprd02.prod.outlook.com (2603:10b6:803:20::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22 via Frontend Transport; Sat, 17 Jul 2021 19:21:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f1613532-b24f-4ca6-8272-08d94958205c X-MS-TrafficTypeDiagnostic: SN6PR12MB4670: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:156; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A7tpfG+MChFyNDi47Jsq+myyhH20SqoFgf2qXmPqlqqkOh8SPCOHoiltA8c13qLvqjve4ocTeNUcUhlYMid5Z/PIonLXTnV7iyh9zE02Tmzc2pXIzoPMZo+QhkX1Pfr0/HowHh2q7AqLMXJQ5T1wEUfSJM08v+pxcFeRleyN4lGuh1lNcdTC4JX02bWP1OllbAZF3SbOAcwKsMYiGcDzNkBBypTkPCawQxww9ZzVEp07wuQoLAjc0yfBSl4HFub2aFf+5e0VSvJFRKLb8+B1gVKX22mgfq8m+gwqvh3L2NBhUDR1K9LwC+rwEJcvy/2ECJHwn8ecAR8G0PK2kQRiBdaGVlLWFq/8Fm/T6MnA3QcMJZm0/A6xOFJ95vCPhPkoi5IbUlEoyqASZ0Ybq/QGm2F7kORDDfgoSvB3K8BBJw2ubrFryGRWKMA24kK5Gw9waZw8GXN3A5YMgR8vZdjhv1KIE0qu/j6qURq0HklJ+my+j2szkh9sxeBnP2Q0fPx1EFF9C6cAPlNJq9g02DGJMPmTtLIejqu0yWfcCRELVr0YKC2B1Zyg5DkffLDrqOrPjrgSz/6FrRqKuh5kY4/ft4m3crOapsXg2SqxMLvmYufeI28Qpfy6PH52/AA47ncBmYIylfVWiFdjyUPNXTCfjbIu2e0yTk3ZC+x/FXKh0e/KG5yQTQqAY6DlOKqNI+Fpj5CyzJ3OQKxejYvQLAivfKW82hoYIjcM9qhUmn5fJlU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR12MB4430.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(52116002)(2616005)(26005)(5660300002)(2906002)(7696005)(7416002)(1076003)(4326008)(6486002)(6666004)(186003)(8676002)(4744005)(956004)(66946007)(86362001)(316002)(36756003)(44832011)(8936002)(38350700002)(38100700002)(66476007)(508600001)(66556008)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cQaOdrR+sS5N7hv1ro6dshtCacNUIe1Y1h4lpyK6ix7rSqYjqqxRcvF54TiEBIgGuW2yyLY6zKrEf0V60GLUXa56st+LXd4H6EsEyRypwyuA0fhivjpCV1ayQFZXwrfuN4UJIipQUI/SrJdFFrGp1r1HDC2rCWuhIuOuouF81wgZQErAcj3KGqvdbBnsamJ2y9bU7bEqYMcWpCoQKNnkY+5c6EeKuuzFX3nmWiythZbphrPgQV1J8syi2WL6x9eSRqU6ROpIzhJIDrvQqh7rN3MnVvMSvu7I7QFx4lKSYdliy017r3jU249xp4czE/rUMm143JI81R6gK0w5ItV5V2/dlxtnTfBJKZP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ant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2021 19:21:50.0181 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AZZUdmsY5ky2qdGqyGUWNKLYypvEIoLvILNTryIf9LrjIy8i0NKuN+b97K/Azx+1JC33d8VmLVgVaIAx74P5Aw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4670 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: E9C57200170B X-Stat-Signature: pu1mewdwmeymezcj6gwn7yh85eggb65n Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=IAYivu5v; spf=pass (imf26.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.212.88 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com X-HE-Tag: 1626549718-388265 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Two helpers added. One checks if zone device page is generic type. The other if page is either private or generic type. Signed-off-by: Alex Sierra --- include/linux/mm.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index d8d79bb94be8..f5b247a63044 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1125,6 +1125,14 @@ static inline bool is_device_private_page(const struct page *page) page->pgmap->type == MEMORY_DEVICE_PRIVATE; } +static inline bool is_device_page(const struct page *page) +{ + return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && + is_zone_device_page(page) && + (page->pgmap->type == MEMORY_DEVICE_PRIVATE || + page->pgmap->type == MEMORY_DEVICE_GENERIC); +} + static inline bool is_pci_p2pdma_page(const struct page *page) { return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) &&