From patchwork Thu Jun 17 15:17:03 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: 12328183 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=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=unavailable 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 817C8C49361 for ; Thu, 17 Jun 2021 15:18:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3671F61405 for ; Thu, 17 Jun 2021 15:18:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3671F61405 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 C54F56B007E; Thu, 17 Jun 2021 11:18:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C11A46B0080; Thu, 17 Jun 2021 11:18:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9BAD96B0081; Thu, 17 Jun 2021 11:18:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0178.hostedemail.com [216.40.44.178]) by kanga.kvack.org (Postfix) with ESMTP id 649396B007E for ; Thu, 17 Jun 2021 11:18:32 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 09447181AEF07 for ; Thu, 17 Jun 2021 15:18:32 +0000 (UTC) X-FDA: 78263572464.37.68A5512 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2082.outbound.protection.outlook.com [40.107.93.82]) by imf23.hostedemail.com (Postfix) with ESMTP id F1533A000252 for ; Thu, 17 Jun 2021 15:18:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XWnYuBWF0AXgbTXoSg6+otmUbTPXIE520i8gl8+o74FLayFpv5lTO9kX7sTZeM2T71S4QU6UiJOAKKo8LtsMFrwniFJaFz0QZcs4txgyz1gAuJaP/KqOe6cKD5nAtWAqJ9WuCVciOT/EzwAhaKIoWGqz/7BOr6/5+N3VxQRV2ZleVBf9bTZV/X+FqX12NwAf09SfoA2XIN5wzSeKNvPLdTIKz93znqXsHZxQ5OEUTqDxnmnYkvYUPu1UEeCF/3SuCu8q5dl7WLulnv9rVeBqOGTyaIc3KR82D+nGUz0Bj+NaZx6NaINcfuv6YErznyyky1hd/BjpZEKkX6FkVptzfA== 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=IBCtJUn76duHlCF8zpr+2pt1DTLoFbBMMCEIW6lwquQ=; b=IFUSXE9uv3xFPzWo7jQWD0hnw0M4DGhPDOUl0qnilsLJHckHa6DlFRCGE4zG69XeiEtRSRWuSZTZSjFi3DNATCYgLGg0e85ir8+bO//ilUFriPl3EGcsMwlZge+xV7kbo0SeZtQo3t8m33nWhI5fwPnUU2sJbZhCxaK5p9VkXqJS8FU/FWX/zHBOHPrTPHMpOdmytFx51rHYUfG0zooQln06P00s1IKbbjYHN+ByPOWZv5OOU0ELwZKeHOzGusGA4+7+lCsfoOvp70rRu3DqTMPvzEMK4nbmKh1II0GLKJPic2qAdJLLMv9E51HVIq/hUbjbH/+CUSCZ84RFUG0bjw== 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=IBCtJUn76duHlCF8zpr+2pt1DTLoFbBMMCEIW6lwquQ=; b=JVoxOKe6+YpoZn/6bmK9mYOEbeO/PEYhu5pBh5cO7QOHRlqo2i1tIte2SfruDXzAd7dYtayoC4pOkVIo7KC6wQ4i0oXCMOBh+jMhWrGCMY1vmjpz9iB5SH7nlxkK/vRG9s+tYOm5OxUbd5H/Q6OH31/vJy+td38j5/NH29EX4IY= Received: from DM6PR12MB4419.namprd12.prod.outlook.com (2603:10b6:5:2aa::20) by DM6PR12MB2970.namprd12.prod.outlook.com (2603:10b6:5:3b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.24; Thu, 17 Jun 2021 15:18:30 +0000 Received: from DM6PR12MB4419.namprd12.prod.outlook.com ([fe80::b972:f4d6:9db3:5761]) by DM6PR12MB4419.namprd12.prod.outlook.com ([fe80::b972:f4d6:9db3:5761%2]) with mapi id 15.20.4242.021; Thu, 17 Jun 2021 15:18:30 +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, Alex Sierra Subject: [PATCH v3 6/8] include/linux/mm.h: helpers to check zone device generic type Date: Thu, 17 Jun 2021 10:17:03 -0500 Message-Id: <20210617151705.15367-7-alex.sierra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210617151705.15367-1-alex.sierra@amd.com> References: <20210617151705.15367-1-alex.sierra@amd.com> X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0501CA0088.namprd05.prod.outlook.com (2603:10b6:803:22::26) To DM6PR12MB4419.namprd12.prod.outlook.com (2603:10b6:5:2aa::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from alex-MS-7B09.amd.com (165.204.78.1) by SN4PR0501CA0088.namprd05.prod.outlook.com (2603:10b6:803:22::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.9 via Frontend Transport; Thu, 17 Jun 2021 15:18:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ada8e25a-b3cc-4228-4012-08d931a32984 X-MS-TrafficTypeDiagnostic: DM6PR12MB2970: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:156; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BoN90s0+0UUQppTlKZvpKHkrzpjAXwaPOc4bV6vb58x/HPmqj/ElTJMPCrwrRQ+K+akucbIp45aYtu/zFri8mUI+5Mg2P9QaICoWLdYLsdH9cX3QS3wf/C526TN48Czb3RJD/RsLuluVx7cGhc0OAgOIT0KAQx3nXXQJfBfUg8pBtdysDBGiUghf2lGJjkZwNy8uWbag/d8xkX5nbBcKEVGMUH4wQloffNvvfSTm82HngR+So0ogloX0w4kRcQ+Kn7VuT1bnZ5+LTfpDihwAKE7PGzkLnAQiWHXvWQy0ojiZLZ1r26Xe+qcUfcys+1rdSiA/UxjfVtUkgS2Gb7NrJz6X+mdfK40D0zPaAxbzrs8cmI9DMFzryzR/K4kHzk31uENN2zVV3ST6sMCD1urYxKLFjXfi6d0MKBYQzPE8PyGESEsBQIZkbdz4hhxgTb+12u38EkON4iyXvUnGm+qHCnzJd4z0DU/hdDz5yYIYuTfEozB86veXrgxoUh7Gm2kw+2PnsdIHlj5IpC9ghzJ6wGvxF3rGwg8nKVeYzvjKbW+u33xvRGP5c3IhxOpVFVsyYCIUM4SvZ1AMxI49In/r3WXbkRzFEYhADKkiF7t0M5+3QC+pb4GfC9npYnGU7XZtBaVTcNbJWxwXHO54A+oa3zSu1OtMGHWtIWmmV08PuTJbT1Bs/rMXj98LfgxBRTpp X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB4419.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(396003)(39860400002)(346002)(366004)(376002)(8676002)(38100700002)(86362001)(4326008)(26005)(316002)(4744005)(2906002)(2616005)(1076003)(38350700002)(956004)(16526019)(66946007)(66556008)(44832011)(478600001)(36756003)(6666004)(8936002)(7416002)(52116002)(186003)(7696005)(5660300002)(66476007)(6486002)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3E8j/8gIW/7G0bA8ARrMswlF4y54oK7Cip6C4IwQWU/IXhSaXmVqNMbDwy2BfYQ6nxXGnItEwWSx1ZzYJQdrEBzjAQZUEUvZaQswitgiPrIzVP4CmOVfrS0vWyo0Xd1+G71kJY635ZIZkLq3ds88s8pjC+QMNiAOqgogmM0G178eCRlm+GpZC04w8K1xUl99v7kHgL/hzh3kTquZK5dpEwk9YmlPO++PHQ0h9WjWbUi2rgN+trAtAEbmcuwXB9VA7dw9w7yM7y5AVSK2JDQiByFUnGwlt/8F9GGMSjNO+AbNIB+Pcl3Q/d5wPPxu7IB5QG2gFqWucpggVXislU2x/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012-08d931a32984 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4419.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2021 15:18:29.9651 (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: e/tS81a/zUIjXckCdeV5/T28s8/iILr8eZZWQRTemEyFhO/boyNqu6UiVrPs961LzphWIocADRgSXCsCw7YsCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2970 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: F1533A000252 X-Stat-Signature: pek716cbrpf4n94rwghbis8u9mkz6upf Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=JVoxOKe6; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf23.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.93.82 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com X-HE-Tag: 1623943101-256769 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000041, 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) &&