From patchwork Thu Jun 17 15:16:58 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: 12328173 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=-18.8 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,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 5CE36C49EA2 for ; Thu, 17 Jun 2021 15:18:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DCA38613F8 for ; Thu, 17 Jun 2021 15:18:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCA38613F8 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 723656B0073; Thu, 17 Jun 2021 11:18:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F9F46B0074; Thu, 17 Jun 2021 11:18:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59B1B6B0075; Thu, 17 Jun 2021 11:18:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0104.hostedemail.com [216.40.44.104]) by kanga.kvack.org (Postfix) with ESMTP id 2A9CF6B0073 for ; Thu, 17 Jun 2021 11:18:09 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B8D5380C5BB5 for ; Thu, 17 Jun 2021 15:18:08 +0000 (UTC) X-FDA: 78263571456.07.3E8385F Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2073.outbound.protection.outlook.com [40.107.93.73]) by imf28.hostedemail.com (Postfix) with ESMTP id 5CE29200109D for ; Thu, 17 Jun 2021 15:17:57 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j7nre5yNlIl5sQnoujTPlLXw41IVnf2AwaKpfy7oYGMrTaFL9uXhcoJajAzsQuOmgRC92oEkSaEqnCl6uUf2gfmCjhK/4e33gKOpjRt7VfQNOHeOww+Fl/crxQRDvdFCjhBNdqQmFoJVbXJci5Fi63VJfs0FfeD6IO44VgPhZhNkJZXMTMTulkdmABuCA6qKoZzDgV4RnpsOvQxnEGFZHvZ4GYGF7ewl0XL6p++NPMjIodoC9bbpEzwAx36twzhBTHOZAQ3jHgM6ro8TMBVEkeF32bACcLw+pH2jojxrVZerDEX12mELAz8LRJVUwsx2iTf4MGT2MozpK6aLdAUTKg== 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=wcNNmSNZt2b8SXEAB5nQGZIgnY0pi/9xR5K7kdrUWjc=; b=nw+cgrijAEoTJZ2dtSSrtJMqDcix07NKsDnGqTDC9vvkit+ZcxMLCS46OYEKVnfuwdjwUn/5FqyfYUHSQwjsgaP6Q7zqW2U7aGKYDjTdRTjwl0W8OQvdMYo8+yndCLL/VTpjD77VU1mqmIZz72Hx1F4yryYzZQgFZD0IiKQ6/Kug4wzYB71AG4h0DJ5OiMQmgluYukLXlaGDSKtiRNlDj9GRNfTGvwyeTk0FWIBA3iaIGbGCXJN909xLrhula33EQrZ4TsglKlUozHDU6Ojkiz9OsiWOns3puuNj7fmgIutpsKUk5fxGcp1WtMUJ+7hgZxjCHzFlZrJTVuu7LQoijw== 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=wcNNmSNZt2b8SXEAB5nQGZIgnY0pi/9xR5K7kdrUWjc=; b=i9RIR9/cESLE7syUb4QVJFJV55NzeqyL3OqJWVpjEFtJ0b6uouMBezxBqrsxUlqCl2IJcLIUNgRO/jsknRjH5wE+7Wf9S1ltnQo0dXXK7t1rcOai2aIVqIEL2Tjtxi+J/N5WgFhzWwk1Bf750h/NIY2SFskE/jUSY3nkL+Q94f0= Received: from DM6PR12MB4419.namprd12.prod.outlook.com (2603:10b6:5:2aa::20) by DM6PR12MB4419.namprd12.prod.outlook.com (2603:10b6:5:2aa::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.18; Thu, 17 Jun 2021 15:18:06 +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:06 +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 1/8] ext4/xfs: add page refcount helper Date: Thu, 17 Jun 2021 10:16:58 -0500 Message-Id: <20210617151705.15367-2-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:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 65d9aeef-d0cc-4a37-e2f7-08d931a31ba5 X-MS-TrafficTypeDiagnostic: DM6PR12MB4419: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GL4LsBA7EUAXwyeBCfBPoNDYN3dNsbzAkqjtwD+IGGG+juTMX27OxrceP8Cq6IfRcgfeh2eTVuJGmOVjHSAc0L9NnitSnTU2cqKL5l5EzYr6xL5DkewzrXSvdpu1J1J6QJgNnaahYOc1zAojEbmfGoNd4Yoe7WAUyhjWvEmvN2v2MdOBJAf5+46/VvuxRrtUzNCVyCzw8x/xgt8yvrwDMZbVyb7f8owm6HfvYmU5zF2hoaoMnNPw5Jjf6UMYIiIbJ8TifsUMS08JBTG9i+u4GdnlfwuDeHNkrbl7P3K7fgCnfZEzv/h2H2O5nQVJooxDd/6DgtNCBNxVQ1xsz2mnX2OMZBoMl7lzY8KUlkGSxJLTirl+mHUYNdiAU10idV3TT/wjZ84idTbPamU3jWwQ40AMb1C9oNpC/PPOCS7gPp2DJaQ2imCO9niOc5Jd+en6HMefXUOH9LaimlUSA0k4GJ7cRwHTb2GjFp09xZ4VVoi5Ujr4DEEkLyIKS0pVW+qpwABngwdnR3SmbJAzh1Qwai4+6GqwcOAIssCshnVwaLVIfnlbkYi9smmvi5P5v3PVb++uzN+Y9g1/5f0m8MIEc6SD0P2V302hIJwm28pSN3/QSm903Vo4C3Hr4I+XndeNwjlfuuYHhbwe5Cazflmp1g== 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)(366004)(39860400002)(136003)(376002)(346002)(396003)(8936002)(6486002)(36756003)(478600001)(66476007)(1076003)(7416002)(4326008)(2616005)(956004)(2906002)(6666004)(44832011)(38350700002)(83380400001)(316002)(38100700002)(26005)(8676002)(5660300002)(16526019)(186003)(86362001)(66946007)(66556008)(52116002)(7696005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Sh9tu2tO7f1wQ1GV3W+2c68TCRxspxnsvjn2MxshilugZ/XFv5aOI8dLsIjLjbEAddRge0VQHV6eU1dHqzjAK8UwFGR9HKr1hhu80bq83UPmSIQDpL9p8I0p1fi/RwMmMVSl+CTR+vYeSLhSr7mRhltFgaypR1r6m4E8IacUPVjKqD9Mo1wVdtSWwNSS8+v/RIL+0gHOqiHAU32TLJ+MMIm4qVodvtDBQF+hqgNRTWYUOlcedBtzA7IeqcNmlIbxiWsBJYjJDTckwholl4dlSg1ryt4OFPG6soBNLZlj7/JtPl2/ldcCVFL9zS7/OQ2ZG1WrFofpWL+azedzrJkpBkh1qgYOOsiOlxHjV1p8RHC0Oq3bUqFpx+HEejdemPYmwVEwrP4v7n5AXZ0eU9RNf1zFuutuWG8cOiU0zK8thxzlpJ+Hfgph9XKsglTK0BfNVwN0/64+xJnyZBE0L8S7epaGxeFCpkU1UdI5rCpfB49xDIqIrDs74l8SzZGFxDOMZFD77uZ/Ot+OKXXFeHo/SN/RcdDLX0VckHaMOJomB00SkHw7qTcSF67n6iF/xPTD9ZGmKDRvTcCPZSYluMAEex6SrojB2jpqHFU5aewFe0cxsBiHFoUyPxGUELan2nXWQqUIKfUb+z6WYVC+oc1Vam/opZNagXdi6lXtMjuG+r9EJgevAWxg/FN/d67XtYkmWOnR6+mfXedYOzqc4WfQv9t3YrMQD+xcLS8uvqfVY95/kY0f21k154pN20+8T9tBEoaMNLq552wDK7C2BMpuxyLVRrgJree0b9KKAJGQLZ3pozjfX7g12S/gdY5M1P6VEFL3eEn6zT2xGt089DRWRvuPjciymeBJoGsqY4YUUgUyC7Epise2/NWWraCN41XK4N7viyD8itRmjrRrcH896lIZlaQ55LIByGetUaUY6CCVvGei4kLkSe4DgqYZP6n0AkFTQVRq/484wopN3YDiOLWXI/L+5OXCFBI1tmLafjrONo3xKbde7asEdpcynSyBi22KEMFwRWxKpfaglJYTtwsvZcrvRHHPbp2k3gyAw50zEbuuKVNXJfu2e2iWBDwYhwuPc1NusckA+/fdr2dXurtqObNyZxgNndFwZoAh27KcSkjJ9st/KeYK0YRnlZSBNLLPH5AqJbHyIT9yXl/hcMHxYKKxN9eMeLnlSNXxz+GIaILE3RaKuaUYMsLdP9g8XV7GYB2Jp1HmhI5fhR7CIi0rNlqSq0KYgL72BKYcBSw+ufNZfsmJMR0aYPFqvCLbnow3ToZTUxQ5yEieGXsnKnsRkM3SZy8G0JTs1v4x0wi33GRD3tke+XgXwl1os4y+ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65d9aeef-d0cc-4a37-e2f7-08d931a31ba5 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:06.4386 (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: 0wFF5XxHEu4TLM4XCXMCipS5ZHZRAom+6uLbmA1hAnqEXq2iyM7XlsyIWKLKHNc91Jqvpp2HAxCGKIoGbUK2Tg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4419 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 5CE29200109D Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="i9RIR9/c"; spf=pass (imf28.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.93.73 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com X-Stat-Signature: kiwnjrthfsutc8qdysfkx85y4wgqiih7 X-HE-Tag: 1623943077-905903 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: From: Ralph Campbell There are several places where ZONE_DEVICE struct pages assume a reference count == 1 means the page is idle and free. Instead of open coding this, add a helper function to hide this detail. v2: [AS]: rename dax_layout_is_idle_page func to dax_page_unused Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra Acked-by: Darrick J. Wong --- fs/dax.c | 4 ++-- fs/ext4/inode.c | 5 +---- fs/xfs/xfs_file.c | 4 +--- include/linux/dax.h | 10 ++++++++++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 26d5dcd2d69e..321f4ddc6643 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -358,7 +358,7 @@ static void dax_disassociate_entry(void *entry, struct address_space *mapping, for_each_mapped_pfn(entry, pfn) { struct page *page = pfn_to_page(pfn); - WARN_ON_ONCE(trunc && page_ref_count(page) > 1); + WARN_ON_ONCE(trunc && !dax_layout_is_idle_page(page)); WARN_ON_ONCE(page->mapping && page->mapping != mapping); page->mapping = NULL; page->index = 0; @@ -372,7 +372,7 @@ static struct page *dax_busy_page(void *entry) for_each_mapped_pfn(entry, pfn) { struct page *page = pfn_to_page(pfn); - if (page_ref_count(page) > 1) + if (!dax_layout_is_idle_page(page)) return page; } return NULL; diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index c173c8405856..9ee00186412f 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3972,10 +3972,7 @@ int ext4_break_layouts(struct inode *inode) if (!page) return 0; - error = ___wait_var_event(&page->_refcount, - atomic_read(&page->_refcount) == 1, - TASK_INTERRUPTIBLE, 0, 0, - ext4_wait_dax_page(ei)); + error = dax_wait_page(ei, page, ext4_wait_dax_page); } while (error == 0); return error; diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 5b0f93f73837..39565fe5f817 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -782,9 +782,7 @@ xfs_break_dax_layouts( return 0; *retry = true; - return ___wait_var_event(&page->_refcount, - atomic_read(&page->_refcount) == 1, TASK_INTERRUPTIBLE, - 0, 0, xfs_wait_dax_page(inode)); + return dax_wait_page(inode, page, xfs_wait_dax_page); } int diff --git a/include/linux/dax.h b/include/linux/dax.h index b52f084aa643..8b5da1d60dbc 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -243,6 +243,16 @@ static inline bool dax_mapping(struct address_space *mapping) return mapping->host && IS_DAX(mapping->host); } +static inline bool dax_page_unused(struct page *page) +{ + return page_ref_count(page) == 1; +} + +#define dax_wait_page(_inode, _page, _wait_cb) \ + ___wait_var_event(&(_page)->_refcount, \ + dax_page_unused(_page), \ + TASK_INTERRUPTIBLE, 0, 0, _wait_cb(_inode)) + #ifdef CONFIG_DEV_DAX_HMEM_DEVICES void hmem_register_device(int target_nid, struct resource *r); #else From patchwork Thu Jun 17 15:16:59 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: 12328175 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=-18.8 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,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 0EABAC49EA3 for ; Thu, 17 Jun 2021 15:18:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8F9B161405 for ; Thu, 17 Jun 2021 15:18:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F9B161405 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 28F0B6B0074; Thu, 17 Jun 2021 11:18:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 266E76B0075; Thu, 17 Jun 2021 11:18:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 096176B0078; Thu, 17 Jun 2021 11:18:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id BB0416B0074 for ; Thu, 17 Jun 2021 11:18:13 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 544521262E for ; Thu, 17 Jun 2021 15:18:13 +0000 (UTC) X-FDA: 78263571666.27.BE94FED Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2059.outbound.protection.outlook.com [40.107.93.59]) by imf26.hostedemail.com (Postfix) with ESMTP id 4948D4202A0A for ; Thu, 17 Jun 2021 15:18:06 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LYng4FCdO2ueeByX27XJogXe0nvh+XRsKggVcT5cJUD+PJ72yvD6hFXNO24mDFiG7+jIWPj6bPxx/49zQpTS2pDuCvB9d1z3DHRPkjSybkjWqLEn4i9JqV78VGVky+rsm5JWDENE5BI90wpgMGLbJ46azmBArDyLTflZ4WmUcPII+Z+zD6GEoTegE9TrB9vq1y23VB2D/TH1JQheOGfxLFraax5pENWQBgpLPYbYEZ7//+7ME4QxAFcfmKr8+g+72zTtnRLj0/aVHr51gbxzl+MvE1ISwEF3RNQjKsOjcmqIvLxFIAfUld3yesB66ZJiCS+86LYXwTc4mud8ostpMA== 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=Q6HGs6MXR5pR6lo6RcA0WNQ/ez2NUvGyVipMq1HQwpg=; b=Y0a1VLkVa0WCn8/DqGzVIr1a3JzRCcSlYL0ROUyRmlQtRngknSIvAEVrz5FazB45uKjVABtx4ACqd0uXPGmLNiOTcuKxj1i1TRDBslXjxda2OvyGl+0Ts93UJz6rd/4fggAOOWawtRtubCobCgRwRE0JHe9esDLTimLOkcDtr5OULJRCqlLs9xvNM3Vh+suzd2Eob9nQlbENCGjhFQPqwQbmTQQxy/gtD4/t6hVY6xvzEgKoR8LZvpx3Doa7jYG/q7ARFC7CgzRk/JO2aHmCPU2ppJJQC4D8k38FkjFCLHKRiY70KrOMR1Bnp24HuA3dI1cAC0I0J9JM7GuU51sIVw== 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=Q6HGs6MXR5pR6lo6RcA0WNQ/ez2NUvGyVipMq1HQwpg=; b=owqrXh3A3knFoZPRp6Sp0BBGsM1ZOiuAv6DmYSP9GoWoDa0kldlk5C/GuPh03ElFD2BXjGO4CDTeUDxXa/50fhSJu7pCBA7+GpNAEKRKzbQuzBLZEoIjh8jdrwIsBq/O80pWgRhfa1/hFpbqri6AbOIn9iAfVPcTv3eCjV0B/Gc= Received: from DM6PR12MB4419.namprd12.prod.outlook.com (2603:10b6:5:2aa::20) by DM6PR12MB4419.namprd12.prod.outlook.com (2603:10b6:5:2aa::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.18; Thu, 17 Jun 2021 15:18:11 +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:11 +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 2/8] mm: remove extra ZONE_DEVICE struct page refcount Date: Thu, 17 Jun 2021 10:16:59 -0500 Message-Id: <20210617151705.15367-3-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:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7589f333-9357-4f74-922c-08d931a31e29 X-MS-TrafficTypeDiagnostic: DM6PR12MB4419: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Zd3Rzdtz51XKLsBY8TDv+8WAGfU2mfHDu9vf5w6N32Un7aDb+RL5rOl4oW4Kt8KjT9p6WPPdeZfMnn6rFAzRjL+NQBFLBelFjRtqomdsLHhAuBSQdC4jUtu2McOAYIVetohZH7aa6DyusiRmBSr2b8uq8/GKGKmqLFPko1GGehug+bNtk6VnO13gZ+7tct3WaQ9YDQaoONIeASA8XGtgp8nHzpkdbQGRxqr98Ty1f5ZnoLFEiKlEf/r6SNSDuOzEshCKltQM96jo1IOHAlYMmyCDo3aO/BGATca3ICxIrXg+lGw38DiM2gxOIgB2/gEaIiCciF77D8w+kdPGf06UMGIJcqqAN7RWB1rQFxdPPMwfqS3IqhrKiGd0zSQiUC5lKX3YVPwy1iAis8Sqygs1R7H7tcwZ1uSDHnIOrjXCbbU3Hdcdg+/a2Ortyl6WGNLdrrsMAxNg2nQUEmffPnJPdxChfeEIvIk+YTf+fge8e0vxrxGDhBQ3288RpiL8Qc2DD/mI+C/YC9NtqRlYaoGZIi1wBEA8mAOfKlylE35uCY6XJohGEUE502PBZ7L3XABSZrzZvpRygLQ23sYy0KnZCn43u5i1HNIWyUDlDjlTmd+xyHaQgk6sMKh5kf+RU9oWfSc81Ini0VI8X8ac6jv1mAlduwmgXq9FWc/pJPFE7ho= 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)(366004)(39860400002)(136003)(376002)(346002)(396003)(8936002)(6486002)(36756003)(478600001)(66476007)(1076003)(7416002)(4326008)(30864003)(2616005)(956004)(2906002)(6666004)(44832011)(38350700002)(83380400001)(316002)(38100700002)(26005)(8676002)(5660300002)(16526019)(186003)(86362001)(66946007)(66556008)(52116002)(7696005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Cb7LZEW6AvFat799gW7j08fdUm7QGdGMYLI66rML/Mb1yNep7pdQkMQtmvx+1ouGjOrN7ngrrV4LIlIrPuihsa+eiUHebR8KrrZCeb5eOQzEOpYOgigWZw4ZIFF3iNStMbbH/tYCnQRkWk/xgPFuNE0WPhLC2tUFeHp9PmvWRagtZcEJNjdqK6yIMsXDtiXS8zlUJJ21c+XWjDIAU3rz4zIvyrw07qNQlK68+aiFNL/yKNDl/oWFsnWUJweiP/BjT1SHZJc77dHYoa4BS8//s8W8/p6nB83e/FicSO3yiOD6BAO7A8o0dYE93MGgqnr+rlDivJOy7yDMGvMSHjN9c6JClPcqUvXa9nieaXsxkD0mbl270Y1JKAAD8TC1MTA6OKF25KfYQo9DiINVtEuW4XdH4Mx14ZCj4xrcSbsEKj8XBNgGQnpEWaZdFec0ODfhOl6MIbPsZZJifqLmhj45uXwUMvUS1MdRCb1DQPgYtj/Vm8X9M2FWvWlReAMxGnhDS6mLtm4vrFUZUn1PIv5hmYXJTjGCeAzdEcCRsaswtp4kJHyDe3e7eW5sX6ZajlkDTyYStzteqZJUMw3io9unWlo4zsWB9BX0yZKD1ZYidGpojbqzei/AXewGEpINDtTZsoF4TeTdCDMm9Nk6q1D9aYuPAJw1neZkKoJGhshGWx7xYlO7JRp+vpg+zUK0mTn/r0PXUyz/sCxk6PwFLFaoIKgqSRo9EcpwmT40SLfcfgXN4O6uw91G8ybLWci7LfuJqUCwkROJ/1ZI4bU+uBJdEzWxD6W3+xl0vcEjTYmv9zJuSv4kj+R4stPCZgpuA+W+SyMcKqxed+vUAQbPN9plV39NH1RHkBQLJglUDPoLaZR1ruKFiuzD9+thU/MOdkOzcXT+GOSFOifN4djDy31CaD3ZpVOxiH5XXF0ByidgwCxuK0P0typkORu5jD6JmPSZGRAkFhUmPEedp3lEDM+7wqZJLdnBOurwoiRZDXvdWL16WMxGiKQMioFxfCMc3BGI4kfI/7HLLQBUeS315zK7079rp5KIKoboRrPntqmijS49oIVlV22wvuL/a9pNbyVdt0tvatQzy/tMsXrbIpRm8zeORz0LXtOf+aLlBxdVQ5NSDlCI3tEuDa4tTNKGi62HqEpktIuC+X8vluzP9mj2ok4tcPoTwtRlf7F/VywtB499aAakj9aB0rHIPOqIouYqEAljizllwoGof2LujOIMRZPJc/nO0mmerXizsGHBrs2eEQ5xYTk9yCi5TEWS9ddJOy/kvtSpHodNb/s06z+I1puY/qZBe2hTwv5EHq/wsxAGh7yaZwKsX+cdE/vQbYif X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7589f333-9357-4f74-922c-08d931a31e29 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:10.9427 (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: fCbltaMRNO6a4bkzK8lyEk/k7emh85cA6icxdayyqhoj7dHx+I4sPdMjW7mKKTDPb3qyPX/AlZbzp5qRPeDECw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4419 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 4948D4202A0A Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=owqrXh3A; spf=pass (imf26.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.93.59 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com X-Stat-Signature: fus5itcaksbzfbd4zni697f3fdsrt6fe X-HE-Tag: 1623943086-705200 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: From: Ralph Campbell ZONE_DEVICE struct pages have an extra reference count that complicates the code for put_page() and several places in the kernel that need to check the reference count to see that a page is not being used (gup, compaction, migration, etc.). Clean up the code so the reference count doesn't need to be treated specially for ZONE_DEVICE. v2: AS: merged this patch in linux 5.11 version Signed-off-by: Ralph Campbell Signed-off-by: Alex Sierra --- arch/powerpc/kvm/book3s_hv_uvmem.c | 2 +- drivers/gpu/drm/nouveau/nouveau_dmem.c | 2 +- fs/dax.c | 4 +- include/linux/dax.h | 2 +- include/linux/memremap.h | 7 +-- include/linux/mm.h | 44 ----------------- lib/test_hmm.c | 2 +- mm/internal.h | 8 +++ mm/memremap.c | 68 +++++++------------------- mm/migrate.c | 5 -- mm/page_alloc.c | 3 ++ mm/swap.c | 45 ++--------------- 12 files changed, 45 insertions(+), 147 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c index 84e5a2dc8be5..acee67710620 100644 --- a/arch/powerpc/kvm/book3s_hv_uvmem.c +++ b/arch/powerpc/kvm/book3s_hv_uvmem.c @@ -711,7 +711,7 @@ static struct page *kvmppc_uvmem_get_page(unsigned long gpa, struct kvm *kvm) dpage = pfn_to_page(uvmem_pfn); dpage->zone_device_data = pvt; - get_page(dpage); + init_page_count(dpage); lock_page(dpage); return dpage; out_clear: diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c index 92987daa5e17..8bc7120e1216 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c @@ -324,7 +324,7 @@ nouveau_dmem_page_alloc_locked(struct nouveau_drm *drm) return NULL; } - get_page(page); + init_page_count(page); lock_page(page); return page; } diff --git a/fs/dax.c b/fs/dax.c index 321f4ddc6643..7b4c6b35b098 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -560,14 +560,14 @@ static void *grab_mapping_entry(struct xa_state *xas, /** * dax_layout_busy_page_range - find first pinned page in @mapping - * @mapping: address space to scan for a page with ref count > 1 + * @mapping: address space to scan for a page with ref count > 0 * @start: Starting offset. Page containing 'start' is included. * @end: End offset. Page containing 'end' is included. If 'end' is LLONG_MAX, * pages from 'start' till the end of file are included. * * DAX requires ZONE_DEVICE mapped pages. These pages are never * 'onlined' to the page allocator so they are considered idle when - * page->count == 1. A filesystem uses this interface to determine if + * page->count == 0. A filesystem uses this interface to determine if * any page in the mapping is busy, i.e. for DMA, or other * get_user_pages() usages. * diff --git a/include/linux/dax.h b/include/linux/dax.h index 8b5da1d60dbc..05fc982ce153 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -245,7 +245,7 @@ static inline bool dax_mapping(struct address_space *mapping) static inline bool dax_page_unused(struct page *page) { - return page_ref_count(page) == 1; + return page_ref_count(page) == 0; } #define dax_wait_page(_inode, _page, _wait_cb) \ diff --git a/include/linux/memremap.h b/include/linux/memremap.h index 79c49e7f5c30..327f32427d21 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -66,9 +66,10 @@ enum memory_type { struct dev_pagemap_ops { /* - * Called once the page refcount reaches 1. (ZONE_DEVICE pages never - * reach 0 refcount unless there is a refcount bug. This allows the - * device driver to implement its own memory management.) + * Called once the page refcount reaches 0. The reference count + * should be reset to one with init_page_count(page) before reusing + * the page. This allows the device driver to implement its own + * memory management. */ void (*page_free)(struct page *page); diff --git a/include/linux/mm.h b/include/linux/mm.h index c9900aedc195..d8d79bb94be8 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1117,39 +1117,6 @@ static inline bool is_zone_device_page(const struct page *page) } #endif -#ifdef CONFIG_DEV_PAGEMAP_OPS -void free_devmap_managed_page(struct page *page); -DECLARE_STATIC_KEY_FALSE(devmap_managed_key); - -static inline bool page_is_devmap_managed(struct page *page) -{ - if (!static_branch_unlikely(&devmap_managed_key)) - return false; - if (!is_zone_device_page(page)) - return false; - switch (page->pgmap->type) { - case MEMORY_DEVICE_PRIVATE: - case MEMORY_DEVICE_FS_DAX: - return true; - default: - break; - } - return false; -} - -void put_devmap_managed_page(struct page *page); - -#else /* CONFIG_DEV_PAGEMAP_OPS */ -static inline bool page_is_devmap_managed(struct page *page) -{ - return false; -} - -static inline void put_devmap_managed_page(struct page *page) -{ -} -#endif /* CONFIG_DEV_PAGEMAP_OPS */ - static inline bool is_device_private_page(const struct page *page) { return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) && @@ -1196,17 +1163,6 @@ static inline void put_page(struct page *page) { page = compound_head(page); - /* - * For devmap managed pages we need to catch refcount transition from - * 2 to 1, when refcount reach one it means the page is free and we - * need to inform the device driver through callback. See - * include/linux/memremap.h and HMM for details. - */ - if (page_is_devmap_managed(page)) { - put_devmap_managed_page(page); - return; - } - if (put_page_testzero(page)) __put_page(page); } diff --git a/lib/test_hmm.c b/lib/test_hmm.c index 80a78877bd93..6998f10350ea 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -561,7 +561,7 @@ static struct page *dmirror_devmem_alloc_page(struct dmirror_device *mdevice) } dpage->zone_device_data = rpage; - get_page(dpage); + init_page_count(dpage); lock_page(dpage); return dpage; diff --git a/mm/internal.h b/mm/internal.h index 25d2b2439f19..d3e58746f2d2 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -623,4 +623,12 @@ struct migration_target_control { gfp_t gfp_mask; }; +#ifdef CONFIG_DEV_PAGEMAP_OPS +void free_zone_device_page(struct page *page); +#else +static inline void free_zone_device_page(struct page *page) +{ +} +#endif + #endif /* __MM_INTERNAL_H */ diff --git a/mm/memremap.c b/mm/memremap.c index 16b2fb482da1..614b3d600e95 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -12,6 +12,7 @@ #include #include #include +#include "internal.h" static DEFINE_XARRAY(pgmap_array); @@ -37,32 +38,6 @@ unsigned long memremap_compat_align(void) EXPORT_SYMBOL_GPL(memremap_compat_align); #endif -#ifdef CONFIG_DEV_PAGEMAP_OPS -DEFINE_STATIC_KEY_FALSE(devmap_managed_key); -EXPORT_SYMBOL(devmap_managed_key); - -static void devmap_managed_enable_put(struct dev_pagemap *pgmap) -{ - if (pgmap->type == MEMORY_DEVICE_PRIVATE || - pgmap->type == MEMORY_DEVICE_FS_DAX) - static_branch_dec(&devmap_managed_key); -} - -static void devmap_managed_enable_get(struct dev_pagemap *pgmap) -{ - if (pgmap->type == MEMORY_DEVICE_PRIVATE || - pgmap->type == MEMORY_DEVICE_FS_DAX) - static_branch_inc(&devmap_managed_key); -} -#else -static void devmap_managed_enable_get(struct dev_pagemap *pgmap) -{ -} -static void devmap_managed_enable_put(struct dev_pagemap *pgmap) -{ -} -#endif /* CONFIG_DEV_PAGEMAP_OPS */ - static void pgmap_array_delete(struct range *range) { xa_store_range(&pgmap_array, PHYS_PFN(range->start), PHYS_PFN(range->end), @@ -87,16 +62,6 @@ static unsigned long pfn_end(struct dev_pagemap *pgmap, int range_id) return (range->start + range_len(range)) >> PAGE_SHIFT; } -static unsigned long pfn_next(unsigned long pfn) -{ - if (pfn % 1024 == 0) - cond_resched(); - return pfn + 1; -} - -#define for_each_device_pfn(pfn, map, i) \ - for (pfn = pfn_first(map, i); pfn < pfn_end(map, i); pfn = pfn_next(pfn)) - static void dev_pagemap_kill(struct dev_pagemap *pgmap) { if (pgmap->ops && pgmap->ops->kill) @@ -152,20 +117,18 @@ static void pageunmap_range(struct dev_pagemap *pgmap, int range_id) void memunmap_pages(struct dev_pagemap *pgmap) { - unsigned long pfn; int i; dev_pagemap_kill(pgmap); for (i = 0; i < pgmap->nr_range; i++) - for_each_device_pfn(pfn, pgmap, i) - put_page(pfn_to_page(pfn)); + percpu_ref_put_many(pgmap->ref, pfn_end(pgmap, i) - + pfn_first(pgmap, i)); dev_pagemap_cleanup(pgmap); for (i = 0; i < pgmap->nr_range; i++) pageunmap_range(pgmap, i); WARN_ONCE(pgmap->altmap.alloc, "failed to free all reserved pages\n"); - devmap_managed_enable_put(pgmap); } EXPORT_SYMBOL_GPL(memunmap_pages); @@ -361,8 +324,6 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) } } - devmap_managed_enable_get(pgmap); - /* * Clear the pgmap nr_range as it will be incremented for each * successfully processed range. This communicates how many @@ -477,16 +438,10 @@ struct dev_pagemap *get_dev_pagemap(unsigned long pfn, EXPORT_SYMBOL_GPL(get_dev_pagemap); #ifdef CONFIG_DEV_PAGEMAP_OPS -void free_devmap_managed_page(struct page *page) +static void free_device_private_page(struct page *page) { - /* notify page idle for dax */ - if (!is_device_private_page(page)) { - wake_up_var(&page->_refcount); - return; - } __ClearPageWaiters(page); - mem_cgroup_uncharge(page); /* @@ -513,4 +468,19 @@ void free_devmap_managed_page(struct page *page) page->mapping = NULL; page->pgmap->ops->page_free(page); } + +void free_zone_device_page(struct page *page) +{ + switch (page->pgmap->type) { + case MEMORY_DEVICE_FS_DAX: + /* notify page idle */ + wake_up_var(&page->_refcount); + return; + case MEMORY_DEVICE_PRIVATE: + free_device_private_page(page); + return; + default: + return; + } +} #endif /* CONFIG_DEV_PAGEMAP_OPS */ diff --git a/mm/migrate.c b/mm/migrate.c index 20ca887ea769..8c2430d3e77b 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -376,11 +376,6 @@ static int expected_page_refs(struct address_space *mapping, struct page *page) { int expected_count = 1; - /* - * Device private pages have an extra refcount as they are - * ZONE_DEVICE pages. - */ - expected_count += is_device_private_page(page); if (mapping) expected_count += thp_nr_pages(page) + page_has_private(page); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 519a60d5b6f7..4612c457d0b0 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6210,6 +6210,9 @@ void __ref memmap_init_zone_device(struct zone *zone, __init_single_page(page, pfn, zone_idx, nid); + /* ZONE_DEVICE pages start with a zero reference count. */ + set_page_count(page, 0); + /* * Mark page reserved as it will need to wait for onlining * phase for it to be fully associated with a zone. diff --git a/mm/swap.c b/mm/swap.c index 2cca7141470c..0a12af814065 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -114,12 +114,11 @@ static void __put_compound_page(struct page *page) void __put_page(struct page *page) { if (is_zone_device_page(page)) { - put_dev_pagemap(page->pgmap); - /* * The page belongs to the device that created pgmap. Do * not return it to page allocator. */ + free_zone_device_page(page); return; } @@ -878,29 +877,18 @@ void release_pages(struct page **pages, int nr) if (is_huge_zero_page(page)) continue; + if (!put_page_testzero(page)) + continue; + if (is_zone_device_page(page)) { if (lruvec) { unlock_page_lruvec_irqrestore(lruvec, flags); lruvec = NULL; } - /* - * ZONE_DEVICE pages that return 'false' from - * page_is_devmap_managed() do not require special - * processing, and instead, expect a call to - * put_page_testzero(). - */ - if (page_is_devmap_managed(page)) { - put_devmap_managed_page(page); - continue; - } - if (put_page_testzero(page)) - put_dev_pagemap(page->pgmap); + free_zone_device_page(page); continue; } - if (!put_page_testzero(page)) - continue; - if (PageCompound(page)) { if (lruvec) { unlock_page_lruvec_irqrestore(lruvec, flags); @@ -1142,26 +1130,3 @@ void __init swap_setup(void) * _really_ don't want to cluster much more */ } - -#ifdef CONFIG_DEV_PAGEMAP_OPS -void put_devmap_managed_page(struct page *page) -{ - int count; - - if (WARN_ON_ONCE(!page_is_devmap_managed(page))) - return; - - count = page_ref_dec_return(page); - - /* - * devmap page refcounts are 1-based, rather than 0-based: if - * refcount is 1, then the page is free and the refcount is - * stable because nobody holds a reference on the page. - */ - if (count == 1) - free_devmap_managed_page(page); - else if (!count) - __put_page(page); -} -EXPORT_SYMBOL(put_devmap_managed_page); -#endif From patchwork Thu Jun 17 15:17:00 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: 12328177 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=-18.8 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,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 8716FC49361 for ; Thu, 17 Jun 2021 15:18:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 344EF613A9 for ; Thu, 17 Jun 2021 15:18:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 344EF613A9 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 CA1E16B0075; Thu, 17 Jun 2021 11:18:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C786A6B0078; Thu, 17 Jun 2021 11:18:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA4046B007B; Thu, 17 Jun 2021 11:18:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id 7C2D46B0075 for ; Thu, 17 Jun 2021 11:18:18 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 181F118028E66 for ; Thu, 17 Jun 2021 15:18:18 +0000 (UTC) X-FDA: 78263571876.40.A1BDD72 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2067.outbound.protection.outlook.com [40.107.220.67]) by imf07.hostedemail.com (Postfix) with ESMTP id 0C7DDA00026B for ; Thu, 17 Jun 2021 15:18:05 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iyA2+3Gd0I6nT/0RLGx+6EJTmE10p+79A3gCCvYv15H2rz8ilXT5n8o/KFw+CSt4bjbl3N5XzWNbOI0zAJP8kwasEPaiVgCJ2HLvjvcUINsu2lS2kaypk2BkCxNyvGHTyGkreCmvMA0hU/hKfDNQfF+kxgU+Ac1fu2u6Zk5D/6Kx5NzRN+KHcqG1WRYkYudXrvhUwIW+o69rjSKX/9w7lmgbUn6jRWrcbH5lcPS0ZhJOWEb9QPKgFrhQ1wRP/rVoWT2IiJdlkq0FcklxyzBAqxXVHtKRvv7XRAcUuBUyzfO1qJUgv4dqv3rfCbrLO1maBPKBy3/Zoo2hNj3QtCxH5w== 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=kAyEHlM08oFq0MP6MAe6GPLU2sVEDRrXuDLmfsvY/H0=; b=d45rdXTpGpA0tTGo2Zh8AiC5s6Rvmz37X/yzhX6xvzl9jvKKAhCg3FesBlRtT2Xg0c/f2lKdW+84Qv6ItXCGymk7vwH4msFtL+tc8jpfL544WttrReUnF28v+5VfkMTdFITIxlasvefX8S4x8yFv7i8MbuqaPNQhOMCMCnZHzR5ff/7vgsF9j01XKZHsApPpKyzcMXkczGSwbO6COtN1hV01PECWkDa6MG/xMTDZ747QccHR7dtPdpgGFKykqcuET742Cp8e5/3pDfW3Ybp8jbQd2/BJFPubUmmaHbqac4XR0OnVleVuuyCQ6oqZJbrGLcP4H8/fRI2wih3p+CKyRg== 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=kAyEHlM08oFq0MP6MAe6GPLU2sVEDRrXuDLmfsvY/H0=; b=XhL5O2S7yQIGGkyIVIWiob50bNfe1Dnri4fw+k60S4Jm3kaP1xkcZ202NWaR1KpkmFa3da701660U0SD7DpvppJIm49GPp3UujX4OhJ5bn9vyPIgwqBIpptPS0lTFLBv4nxcdC24YkhZKkJLQVLcfjodFfpHY0N2pk5pIMH8kHQ= 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:14 +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:14 +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 3/8] kernel: resource: lookup_resource as exported symbol Date: Thu, 17 Jun 2021 10:17:00 -0500 Message-Id: <20210617151705.15367-4-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:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d163c79c-44f7-4f4a-a116-08d931a32028 X-MS-TrafficTypeDiagnostic: DM6PR12MB2970: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kx7bObyg6Zv7+O+CQOnpHh+Vo3IoQDPp0TiHFt4U6XXNxAn9iEoU7tPwcN+dM8Y14Dp1t8g/1lTCcQr94FDzFXroH46JfCHOniso9m/jXgYMsTd9ZxOi/xMVhr5Swz4F+zHsc0hpEpzBkWG9k9Te+JyElgfi7r1OKxeZgBv/igSAe2tN0GL8T0CzN8T3YH8ct+uq+RuHcrL1wVfFTn7eDKV8agT+K57Gj9vJFcx/wPymmW29leurYUa0zDLBWxRxfmSBcxlXHyc9qEZSq1mT1FQIFCcRv8C0wVgihjRxFY5VScoT4JQj6rPKSXipwrwCjDGutHyXj8EKZ6H3Xm3WLGnetCgUL+/guaB2bFqJxg6fTcjBJBr73WimGhER30mPBRX7/o9o5kBsO4htdhokjsq/JEegE+FUAcdgXI+MmDH4R65sEfbjB8OhMFEyqJsnMB7VA4CfQwaYeI4LQpvlz3DkKhxOBe++8LKikL9w0MVuVFRB4ct6MgDZIWug2zEJhdcbKUoSdfhVUlimIoOMp4u94L9Js/Abf+vqAYNI/PA8+63vjC7S8r6sSdaPDtCrTtA//N3wj4gw1nf/SfvVZIxArAdkNty5OSrPJmYmn1pV9K7US92KoqoA3tm0P2fhPBy182W9wro2KiMIQBKN/rz8GHom+svW2GX8VA487qo= 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)(83380400001)(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);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6la5hMQ6ghu8zAjX4Qe/5QOEU3yY60ECrfi5D7Vx2PzwGYrqja+0zrdA70DIbpj3AjTYT6vLloHPUrVgsV7FbU6dBmj5eGQp9Rjc7tePcvrGyPJkxLGOT26eE/2um+mRVnXVMtLY2vqdTeJ/OOUNKptXh5WfdnGRyHXtvJCyY2NwEjLnSnUtlIGw8n+VS9LRuG0L7JC5jBQ08raJeBahtyal0HTREhEwNzf7N5KH+c0rJkFOgEE7XyBwuQytIE/mi9iICpu0EW4tCTx/ubB9qDsuxDxgo8MywV0+OX4roEeIlvmEzX4FT4xUUdsSZLUf/JLiOm8Qa9xLHhIBPQOhfgTm102BwgCgsyGuAhfOgqvOLZa0HhF6axi1BRK1GnGdoqyMt42ugc02I9b1yFt5W4/d6NN/7m1R0bVL5a1TQJSLJbuJmNnlaOHxnZ/MPcfze0kroSlHkZPB4Ef0NLfqgnRwV+iHrX3uvcqcwReqfbOBIL7u81ZbOgdUcy6Ok5fH7kFLeD0i6tN25hNsTVXUPMqm9OudCf9f7cDxPsINGvDI9J//v2Mylhw19OfoSk6mkTnu4Fv9pzOm4PKDkbjcb/r1foNQ7DIFMw/2t+Z/IXQr8OviVd/BPWZ17kB3L3aoVhIcFmaW5MG4tOVWWJE+SItdTKxyfeZnHs90Y7YpXcPRiREWzLUitk3KXVHhFrkYvQTBLFPgQ0pRhmD0WP5tnVrMrRDhTBzYQ1Oinm2rwOYsonilPKdGeAEDsq3mY5JHUvwJ463mbttaimoskHv2ganKlwTkwCQHUAe0PkiwexysCbQ/wd9TQi+1OQAg1TED+AiS6aKnM4DLEdjbFZ5TPbRUBcbtdH/uk40Y6aYInz9IfliMjng2LgvzVVTg2zA78s60Euzw19VsSiizJ7aCCh8h/ef5LyYDgxLcFp8uKhNTVzdCo1sjPtK53V8TGAUf6Aw7RG+CL5dU1s4mbKP9O/+vc4QW4xI7aSu+MLq8zlIvDzgx3OsJBjltmBF+Wo9aW3ANUoLA1g/aNjG6cw26Y+eYj1dIxHqAbT56IMd3fDFRZr06L8V1h0bYbBR1WMyUgAQ0RRgIRpjgVuetPD1Q9AMBKvRHvruglmGqhwF1+WffbL2RNrQMGQU1K1D/8TVEqVKXZhPWQi/BfWn76bnne/MOOKd2MgC+uswVcoBDX/tR2sf1NUSdu6REGoS+lCBDFShb3JCPk2pRTeZFIA5RAF/VNtCclSmcxyRGBz0VI0rXUe0zUU+S0IDPq9xdv4kYUKDFJrZ3X14tWfr6vZK+fGpaznnG1fSqI0ECJAol8TqFm3FztvJPANOs42lxXQ8V X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d163c79c-44f7-4f4a-a116-08d931a32028 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:14.0959 (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: H0KNQDuCw1IyqTnabmyEPSJf7cxuUWVat+EIW2Bb06yFCE35l864pOsnJBlBnPvlB+tOUP9uL62lsQpMFUPfeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2970 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=XhL5O2S7; spf=pass (imf07.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.220.67 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com X-Stat-Signature: ixty3exfymagi5aqbz6wkez4ijxjyrig X-Rspamd-Queue-Id: 0C7DDA00026B X-Rspamd-Server: rspam06 X-HE-Tag: 1623943085-630978 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: The AMD architecture for the Frontier supercomputer will have device memory which can be coherently accessed by the CPU. The system BIOS advertises this memory as SPM (special purpose memory) in the UEFI system address map. The AMDGPU driver needs to be able to lookup this resource in order to claim it as MEMORY_DEVICE_GENERIC using devm_memremap_pages. Signed-off-by: Alex Sierra --- kernel/resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/resource.c b/kernel/resource.c index 627e61b0c124..269489bb7097 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -783,7 +783,7 @@ struct resource *lookup_resource(struct resource *root, resource_size_t start) return res; } - +EXPORT_SYMBOL_GPL(lookup_resource); /* * Insert a resource into the resource tree. If successful, return NULL, * otherwise return the conflicting resource (compare to __request_resource()) From patchwork Thu Jun 17 15:17:01 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: 12328179 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=-18.8 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,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 65465C48BE5 for ; Thu, 17 Jun 2021 15:18:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1296A610A2 for ; Thu, 17 Jun 2021 15:18:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1296A610A2 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 AA6446B0078; Thu, 17 Jun 2021 11:18:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A7C3A6B007B; Thu, 17 Jun 2021 11:18:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A81F6B007D; Thu, 17 Jun 2021 11:18:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 564E76B0078 for ; Thu, 17 Jun 2021 11:18:25 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id EB19210F2C for ; Thu, 17 Jun 2021 15:18:24 +0000 (UTC) X-FDA: 78263572128.40.BD8211C Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2053.outbound.protection.outlook.com [40.107.243.53]) by imf17.hostedemail.com (Postfix) with ESMTP id 6F3FA4202A03 for ; Thu, 17 Jun 2021 15:18:16 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CtT7kGqvM65Dc3Xb0Qs4HL0QJUioENtjVS/xPbxd+0TAoRLHQJWOmOcqacA5qDy8sPahUrhs6wlvtPSVsufM8MRpB6j4x4qNcEs1hrgFfFlYwRTsDYH3d9QyXfgDUgwllTuEiXLtG4yUG4buh8BWzY9RaeY7bAFHfYfF77vJJ9Isx3aWb3djoCXPf86H0TH6fBGGp4FZfnDqK6YcJOapzM0xC738dk8nOdv3v8SJYyiqIfw6rHGtiVDsIY8cXZ4xuwIFXuO/HvZPbn7EiEY04Yrs4dfOJuBz52vUupSzz2Xpt3+/VnEiKlb9wGETBZB6rN2bzrmQK5Qgm/e8BZAOZQ== 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=xVTS1977Z/NhsI3R5uOCbHIiScNTi7F80jObhOphaDI=; b=IFog3XCupoaS33gX9AmPATKlDH248nlsoThOgeVCjG5tYPCgTC6ICTCN0znYKmKtfSVn6j61VljLpf8KrIMToZeoA6k35hLicWTYPQyq4/j0DzpKIhpF4NFKG4kk8bHXH27KjimhIn/P8JjkmWrXo+mthsFMUHHs70kVdBDmmIjHGtZpLuBR6SdLN/Om1fynHmD/xSpkegR2Y7dbjyMfCMwzwz8o/pWKVUqNK7JJ2UNQ36OtESj8R98ru/vB0erG03YIRcBHT5T+V85eDtIc0g+te3lvrCdWK9Y0E2o3AjPhtf7hIW8AwKs0gENdU/R7h88iGNfFDXSsxa+UoYPWPA== 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=xVTS1977Z/NhsI3R5uOCbHIiScNTi7F80jObhOphaDI=; b=TYvWeZv2WmdD6pu7jF+oxOKJPc6H2USmhbw6YnbTvn9p9QDJ3aRbgTP+sLKR99xaqwpwjWZVypyjKkW7clBi6em27Qlg3EG/7JovH03/2Y5i3mYzpy2QIws/Z47ys9QAZDB6DKqhcNn1258LkybQKv7QtHBfbajbI2Jk1iE5acM= 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:22 +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:22 +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 4/8] drm/amdkfd: add SPM support for SVM Date: Thu, 17 Jun 2021 10:17:01 -0500 Message-Id: <20210617151705.15367-5-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:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6e222fc3-2451-4fee-1a04-08d931a32540 X-MS-TrafficTypeDiagnostic: DM6PR12MB2970: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1dffeFeBfSIJSZzT1h4W1ApdzLMOQjQsH+dqS4SJvpl3aiVriZVqNyuBMD49aUK8e4OZpYnmzzxrIxjJhEJ3j3X+QKqMvFlr2rAyhPvcLBywMGGxWIBXIZ2ZqGbTxL+vzVByVmCahRlmuP+oGFZg+0c4Ef/njzi+pwAkqVBoT/oYzc7Fbo9UKGzqzpEqBlGpOJw5VRSMmaOX291ze7VSTJCA7Jpv0kEFsH/nzjl3aZ+3yHxEQJKQCnVxNF4nKLIM1uVRrqbif/gWXhSBylEdYWKiTOhLa6CdTtEt3LCV+yYgsXiRAw+fSxWeJMByAT3T2jtyk0RNiOtf/9R9YJJlz9MqR6yLmtwQM/QBQleTAKbFEBprl30eQTUNPmFB7NsABvcQc3DWsrh3xMy6r04Z0HISlp3p5weGhs0qhx+e++qf2J2pDrda+GQ5fuPcXkFXg8L8+TxNDq5n8twtZ/bUMqmQ7GFeY8PsgAZW/qNxTts1iAUwqbi3AnA4mFxncvowgRRnZKDcJrp3x4zu7rjA4iX8AZ06pgRUXWwOtMic5K3KRkmY6/5shHvjxvWkXxb9LBWUp/QK+qHTI1e+aDyWRdiUFqJiOOeOzYhtj/++g96EXx2seeq2V3O6at0BvxqnYDdsBcVrWhLQF1bMSWLKzEOlZX54Bc/La8EQ6juiyuI= 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)(83380400001)(8676002)(38100700002)(86362001)(4326008)(26005)(316002)(2906002)(2616005)(1076003)(38350700002)(956004)(16526019)(66946007)(66556008)(44832011)(478600001)(36756003)(6666004)(8936002)(7416002)(52116002)(186003)(7696005)(5660300002)(66476007)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: h0A+lcVeRKteG7VYEDdIoE2mDzDhdAbwHM8hboJY84lH3MruXTun8IPaoAmf8ulHlyrkgAuE51HxpWN2md2Y5i/8mVo9/HCe5bXvlZvedREkKFrq9S4E3mndiW0Fiw9hPPRaAtrqr9m6thzpUTeMNK4U4um5auxzc5BmbQY8MrF8HZ9HPQOtkiqQTR78skY+xNpPKutejZa5XAiFBuilj2Z235LR+SWfQDw+Jcz3OUMp7g46YKoMpwdcMkwriMDP9pAGDKt49rgSq8Q47xnPLyrgQzhX3BOLk8bXYafifGkCm2o5fZRip0rGZ4lJDuNxqMJyoPUuk572w98U+1dlqXS096aDX7l1mHlkcTL53Mg7gKDrbDIf7nxpdL6j/uw7B7vh6uxJaO26ftzcf33K5KerDx+/RMOVhMEqcq1Wio8UJokJQS7uggmD94CAHOpkxqETBTQeVIbwl6AMkXaK6u518mdqCXfLmX7jSqG9O7NmIWvuV3hgc2FLb0OTEH8j+AZexg3v7TbuVuaLlMpYFGu8kQgJ/2J/OnPbHM0pzeVgjfYxa4OnhulQlVYfnvh6vquk1r36cHTL39UYm3Zqsy2L8PXMuMYL567clDoUl2XH2Mti+okXZmhfmKI5tNx7C2n7+ZfucBapBEW4R/9yg1SgXH+v3Frbx9EniMVzBksueAJkvpesP0hPHqYFMfFlXZqA3dp2W5hFKd/ZZ4Nm4LXaBDr1PMrSh8AYrimIWU1JQg314KjRVZjqVcJ+h2CUhk8aR74Y9/g3q4Jz4DoiT5bywHqVjsW/zlFV+LpqAlhtDZUNeANcH0VZKGCKU8KmfUc1ip/SSSNPnT2VAd9aSTk6CAU9MsBnYYIIJ68zgqqhHMdvUrSW0mllxSke+aBFikoJf0o5d006o3H7m2oqkd+DETlYDG45AloPL+e8wJwmwJnIgi1yprii2N1l3PDZGFBdrUkg9pn1BEFVDJ8s1K6sk0c8b1xkcNYJMFTGSvyu4JgF13S1mc5AKqBA8ClN94IHXyno52ME2k2Yio3LPPSV55QeS31anZZNwa0mWs0adVsyJQZi0KU4NO1hZLItFvzwNbIHMKDMnRS399Kt3Mv82bUELrs8XEoivVhPlHelD/qSoJ0Hv2JvfeRiHdLzf5o5e5JgNyC0EIiqJBt1WpG6ipI4YuLGNrMjo56wrRDc28RZT+BQBWJLr1a3pBEszvJFnVIxE+95CWOQwOZUVw97nFMwzHUJVfIM7ptlxz6u4WgXIDLBzRussnshGGem2PCs0oDw8Bjn9rMdptZcYgIhXsGmyiajGYHzOoOBt2sY69z+t6XAlCmsdood18je X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6e222fc3-2451-4fee-1a04-08d931a32540 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:22.5617 (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: FhIS3r3OBJe/MUYa0fYE08PWdVYRCFDI5stqs3vWdZeEymJj07/E5DNZgMJOAXoleSvgc0M1fsu9CaAot65GkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2970 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=TYvWeZv2; spf=pass (imf17.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.243.53 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 6F3FA4202A03 X-Stat-Signature: ttymrmhsguox8p8uiegrn8o573igkxxc X-HE-Tag: 1623943096-272933 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: When CPU is connected throug XGMI, it has coherent access to VRAM resource. In this case that resource is taken from a table in the device gmc aperture base. This resource is used along with the device type, which could be DEVICE_PRIVATE or DEVICE_GENERIC to create the device page map region. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c index c8ca3252cbc2..f5939449a99f 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c @@ -895,6 +895,7 @@ int svm_migrate_init(struct amdgpu_device *adev) struct resource *res; unsigned long size; void *r; + bool xgmi_connected_to_cpu = adev->gmc.xgmi.connected_to_cpu; /* Page migration works on Vega10 or newer */ if (kfddev->device_info->asic_family < CHIP_VEGA10) @@ -907,17 +908,22 @@ int svm_migrate_init(struct amdgpu_device *adev) * should remove reserved size */ size = ALIGN(adev->gmc.real_vram_size, 2ULL << 20); - res = devm_request_free_mem_region(adev->dev, &iomem_resource, size); + if (xgmi_connected_to_cpu) + res = lookup_resource(&iomem_resource, adev->gmc.aper_base); + else + res = devm_request_free_mem_region(adev->dev, &iomem_resource, size); + if (IS_ERR(res)) return -ENOMEM; - pgmap->type = MEMORY_DEVICE_PRIVATE; pgmap->nr_range = 1; pgmap->range.start = res->start; pgmap->range.end = res->end; + pgmap->type = xgmi_connected_to_cpu ? + MEMORY_DEVICE_GENERIC : MEMORY_DEVICE_PRIVATE; pgmap->ops = &svm_migrate_pgmap_ops; pgmap->owner = SVM_ADEV_PGMAP_OWNER(adev); - pgmap->flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE; + pgmap->flags = 0; r = devm_memremap_pages(adev->dev, pgmap); if (IS_ERR(r)) { pr_err("failed to register HMM device memory\n"); From patchwork Thu Jun 17 15:17:02 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: 12328181 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=-18.8 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,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 7D049C2B9F4 for ; Thu, 17 Jun 2021 15:18:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1D333613F8 for ; Thu, 17 Jun 2021 15:18:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D333613F8 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 74BE06B007B; Thu, 17 Jun 2021 11:18:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 720A56B007E; Thu, 17 Jun 2021 11:18:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57A0B6B0080; Thu, 17 Jun 2021 11:18:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id 0FCCE6B007B for ; Thu, 17 Jun 2021 11:18:29 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A48E4181AEF07 for ; Thu, 17 Jun 2021 15:18:28 +0000 (UTC) X-FDA: 78263572296.30.1DA8593 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2074.outbound.protection.outlook.com [40.107.93.74]) by imf05.hostedemail.com (Postfix) with ESMTP id E2EA4E000274 for ; Thu, 17 Jun 2021 15:18:13 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kJuw/8N4y0aOO2900C56kadzglwt8951V/EThqWig1YNSZyvGmwE0YbhoJnSlEtCzTLt8xKXydF/NC7obrmVvAI3ahxilbJ4/alD3lYIEzO0svtxQrCn3LD7CNpvMhUgSQUFpUZq/x33MjPUrXKysXaDo+7AUM3pmIkDz4899R0K089Zo0RR7X0qSSoytXYs2alYTynJIFeyX1GONcLSLXVQCVFdapLKo+2jnWvaBKI62qgr/xXCmMNa21IoW0RI+QPWIo9SRqDEOfrYIXuy19d3y2w87qz1T7FUzm9cLAFMkY4P0ILnK1jlkaQpwcxo7I7uXHvHJ7Dba7Khjmh8WA== 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=TPKPnrddVPbEN1uQT1iXLcCa/cH/uvZqBGSpkg+C9cA=; b=ibLDxYAvcIVRpe1nN+u5MIgt6XdLYhQka+z3zGi0kzWpTL3ZMUF4A11/RdSb6uxa0GIfbeqMfdnIgsNHbf/LIbnbkjvRMbYY/p7yPUW+JthGtR61szKmAZ0V6fmWI7m/bYCT4/7E8FSnfuEp5pI6D77CkEIPUyVzGDXwUbye0alJ0H/On2O1vpa5oPELSiL0u3HYKKG9jtx4uKGtBASVaLsidF0noCvCM5KofM5biSdwjSsfCg6cAb2HN+U8VLQ9h1FJTyrGuy2zfwtALjAWB9lKpS+rhE0ve/rhS8AP8t9VkffI3RZ1Phx5HgFQpB7t04D3hBPhuFy9JsBSyKOEmQ== 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=TPKPnrddVPbEN1uQT1iXLcCa/cH/uvZqBGSpkg+C9cA=; b=Vqgjnk+bUMDIWQwvDUkffgbOyIUCqOKuR2owfcD4Q3CQsdIx9BS+BVOlAMTe5XScQJmPYZV7ZI6QwkkMqQnPRbeTRzPY143eaxEKoK1upnHLQD9mk+tGR1AbdRibuYVknak3cJzZrY6SrYfXbHMZeoikitqCfWEyeVquxN05lZo= 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:26 +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:26 +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 5/8] drm/amdkfd: generic type as sys mem on migration to ram Date: Thu, 17 Jun 2021 10:17:02 -0500 Message-Id: <20210617151705.15367-6-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:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b350ef04-f328-4fb3-c8df-08d931a32768 X-MS-TrafficTypeDiagnostic: DM6PR12MB2970: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4cwWoqgiy58PVGX/pnQCMxRJifqV4eE+vtWeu3E+kjfJa2F6eEpqGcba/Lblfh9bNLVXXNBnTLniFW+vY89M+X1VXF8jVrAR1dOWxUszsTBe3H8/AwhTUQ3Zac9LyxjQAYY54M9UnDn6sK7CaqzFK4ghNkmCdtl4atd7k48Y+7F/uIsY7QJxXDk9418tBTJglxcicDrzEhTnQLnDM3eCuIqtNcgIkG0jw+38JEzNe+OQQk3N8ThI13Zm9zG7bEEtLTg2B/R7s2Bjxr8qQljbUX/QzekeiTuW4BB1eE+puBYz8pX3egEycMQrJuJDqzk7qglTIGb2ejJQiDTGVZhOnkq1oYiLsPTjFsFFyW8efnMf8Us3M8xxo2b5FH45VqvLMb1td3oTjjy7J/nVjHjfqT8o5Mzcxl7Bzp0fnADnnYboGdiTl+2+uaXMHLrRt4VoR+2v50bVe/7o21sjaVU89zN9HLu5TTrKAMmklTGcaa6EsbSm+xaiFFd8R0iWUpZ8OiJxSDM9NZZ4oEFZM8TW8x6VQQxCA622gxnIVFk9x0ZmlfUVwy4szPlzSkAXw0y1XE2tmoVlILIvGJbtugzMbHlrA/wJAdB4fH+5gE0leYNsh+tfWykEOmaXbTqkocVoZxH6V7BKVF4k+RTRwN+AkYIn8/b8wRZFwcoElaYJUr7F4NjbIhwSdnLoQ5Y5MEbK 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)(83380400001)(8676002)(38100700002)(86362001)(4326008)(26005)(316002)(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: R66+5ePq/PBySwRySrXyBeo2wBczzA+U+CvnDGAGryk+u19hEY+ppqj9tw3XpRpznljrhGT+gd2LKSb3pY1TC3ZnvntFw96QhqYTFurwwn/LUHSF9qS9PJjvMIqxRDZeOVC+eUW7aJBsVdJaFgVmXlnOQK7XZCw0zXybxTYmCJ9WUQXIZ1HxKgYmBnkrKBYsxWaIptDrh2J1rHDhkLzztyhTGTBPQk6c4/YW7xj+01pahmX9NkmL51MNe3WxLGMl8pkn3buHAea6HrzWTjSaOYdo4FXHFtTMT+PvvZ7hSxz9x1xKE4g5TzYCj6ui7i6BJbXORnt2Mbn+DtllE5pna86OWylaboa5UjYyAUChnQ6ysPnM1zajLng8pbJvqXL9RKDl/687ag48zFAV84rrXM+WKkhNi+xHKGKPCkKWIxPtZ42NAcK9ooWJ86NfCnWJyBkBc4BO4k5w+ZnQrFXlaloO4ytOCYrByPOhDj0mshH+v3Prri1ivRfgkQUpPr2oCVmhyfuswbL/T2u2gwKDoGUMiAGYsA1DUipwmoiBhfTiRaRT1dUnghf2y2Df9pcUJv1n9jVB+Qq/jCjE4v8y8+DFIY2sLcA5q96kSv4MMDyHHATPFp+ppLiONA9To4xPtEtRS03x+3/g8CUCyEf6q6h+RaEGKWawi9o7xQF3Ld6Xq0eTeMsEraLHQ/fQfREQQfMetsLnUEloAKO4rYLsowY38r/3HAS0DbUCpp7YTbiGsCXu3yyadkrHKGOPwO/Rd8VvU0j2kTxG/iECkNaaxskkCMHD/Az4sG7tl1XlSa2It0Hywv7cqLzcDpxuFMB0Wnb7KOSggbSLbkoFwr8mN2TTJlegOyEwujRnoMCG6dY9dp14SEtuuX0KmJiT+CY7GOAAPgHQsNtBatQ/mq28l3XdbcuQTcxbPgJ+p/wCObLo4jNzCmHfmbiogS/As5LmLZ25VWwzf/fScHn4fPSOsGBoc4RzNFer00a5JMXn3iW0q66A8WuprjA6s/aSzOg8RFmJFP2LfFTYlvKxnGEtd1sjddB8kADP6eGBl4+f9aR9IiOzxuikrUfXeswwFDRJ/CnupVHcD4KiGMg4nc8smXr/2oTswXnyTyg+WHJQ06a2vXw2H1rniWo5PjV3pkpHi/FT1Iy86625GOyq5SSZvehyEKHO5Hvy9KA+GCgWX6uP4+9o+Hggbu2GfMaPWhomlccgEhRDW+YAlBulkky55N8vSVIv1CviIiXahVsP3s+op6Ymg/5XORZUfi15LuLUv0p/Rnzn2RlmxE1yLPuLF6zN6LJ8+5ijHMnQLPkzF1Cf6ozTyGiT7PSpVJ+4cUBs X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b350ef04-f328-4fb3-c8df-08d931a32768 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:26.3112 (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: M0gK5PufHGXsAhqrpJnZpzokBkuLGJENMqGkqg8K+AhlFOcgHj8Chb7omRLoz5hsbZA2bNUSoxVdN4vhMz0ILw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2970 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=Vqgjnk+b; spf=pass (imf05.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.93.74 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: E2EA4E000274 X-Stat-Signature: eopen7z5itsrym8igrsyewkzpa6k991r X-HE-Tag: 1623943093-710328 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: Generic device type memory on VRAM to RAM migration, has similar access as System RAM from the CPU. This flag sets the source from the sender. Which in Generic type case, should be set as SYSTEM. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c index f5939449a99f..7b41006c1164 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c @@ -653,8 +653,9 @@ svm_migrate_vma_to_ram(struct amdgpu_device *adev, struct svm_range *prange, migrate.vma = vma; migrate.start = start; migrate.end = end; - migrate.flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE; migrate.pgmap_owner = SVM_ADEV_PGMAP_OWNER(adev); + migrate.flags = adev->gmc.xgmi.connected_to_cpu ? + MIGRATE_VMA_SELECT_SYSTEM : MIGRATE_VMA_SELECT_DEVICE_PRIVATE; size = 2 * sizeof(*migrate.src) + sizeof(uint64_t) + sizeof(dma_addr_t); size *= npages; 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/d9ASnUe0kQ8fMRpSO3A+LMMEjd5hNuhQya/0M7UNliPHCUQmDZMUwIU8150JIZnSbzMufq2Sdt/ysS7U+VtzVExj9N8Vy+6kmLN5DCCJG/oKROXTQyy20cCb3l68jHe4JHyrYeTAkLTpZU36w5MMH6p1S4HOtBA9V9ZEq1GUTwn2DZ6g6n9xsQnENqo6IzVhGOiCtJubkngoxXLqTESzBQ1NJAiMAzAmaOoaHyc+SiHmtasluQ7dPDeUQs8SCdqXEcNN0ssJZhKUE2SEmhYG5VfaHV8+qYnt5VnHjJZgVIKO78cmJzgCYiFEOxM2WrVCKFUU800iW6IQjLp13jhayAemzywOTfZ0RGmC6l2msqvZnR+0hjBKz+q0Bv7TyOh52t1ES9YGSxKIA70h3TEbAjf+gVjYtK3/5GMmVYW5MQxIZsKcdKPWjmSGiQHY7tChVx++LkaB0CLa0hxZQYggxpnEKg+Ahh21/YZ+ukF4CPbd+mqDxBqrQv1sPabHpwoDHxV7Iz3ToVPIgFUVZFPr/tX5j1t8r3pWw/rIWdPCpfHs8AZwTTQbDN1WsGthEq3yHBjkA47y0hzr2I7zuq6Xd/BufcGDEL/Cd7k3ozJqzhRN5W6mhhxIN9zB5mAFfH02zCz8FV+oRCI3vAfsneVm4xkOjxRjJa2WCi/zbPeT8e0XSZtxAHYn6RXgVNd57lOj1prO+61RbwJPsyMDN4+o0EObVkDRcLFQe+g2tUlPPg+D/+LT86BMfouVkJgh5+6JGckVc4OXbdQ74g+wtGyzgmZdCkiNZ/dZiRDC5sbKR9aEIh6rVaewe1OFufvBgYM89eEV2LlroNk2ilcYRyj6U3ifO8V1Uw36Hvz+RVxP0SgieP4NnkEvNUi/WnzPgK0LZ6IiXIZpYZuiRpANABR25lxyrVRV2E/x6NEAr0qsYbF0UgX2KIUFdujsCDfqV7TttUjO5wL0Gu4vMSGAEnKjXcUHPT2xggd/tG/gSWMEmcb X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: ada8e25a-b3cc-4228-4012-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) && From patchwork Thu Jun 17 15:17:04 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: 12328185 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=-18.8 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,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 7D47CC48BE5 for ; Thu, 17 Jun 2021 15:18:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 33285613A9 for ; Thu, 17 Jun 2021 15:18:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33285613A9 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 C53506B0080; Thu, 17 Jun 2021 11:18:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C29A26B0081; Thu, 17 Jun 2021 11:18:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7C796B0082; Thu, 17 Jun 2021 11:18:37 -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 797A56B0080 for ; Thu, 17 Jun 2021 11:18:37 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2731C1C97F for ; Thu, 17 Jun 2021 15:18:37 +0000 (UTC) X-FDA: 78263572674.28.E6CD66F Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2063.outbound.protection.outlook.com [40.107.93.63]) by imf11.hostedemail.com (Postfix) with ESMTP id 5FA37200109C for ; Thu, 17 Jun 2021 15:18:23 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PW3xktzr3m3ME7MrEJasHHaBlVSyI0j6TdkPvJhkssdDa6KYs547nCd77loAMblD+h/iQhmBb6jOp8jupv0eOXmS0wglrD2cq6QawBkUgKLd5w+s0E07fHZ21RVvmNHN7FuFxINLcXunFDWJJRkKtodv46SvRQPoWMSq26Guy65JEUG3X4Q2npfu/d3uQJ1ZfJGXcl8FP7wrp+WFf56aASGZyqzcCH8DodiJtTk0UqVTQ0JwcO+hC74EDhvaHhwXhFriTfHG+JiB/7k/876EXUJ36+gVWlgYTPPdm91ts4lbky95ntvOilPHweJp9Ehkk2cO3jZGSvNnOOJ2sXDXsw== 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=cZgqia54AVI+Kdm1/0jPmLtYO7Hb28fRehM2Aoj8kH4=; b=ALXcm/f9jPIFGmFUwCeEAvy5qsCHqEZjR8MxRwaA6/RgSlWa3keMLmyCeW4TMnvlqnEKmQKGDlA78gS7Ccru+M/WryaysUhQkgtaNrV74RA0Tvrd9d4xkaLuk8O9Ca6qINzAuJ2Bf1aUvZD+5In9YBuYl1bJXS4aKK7DgAYT9cqasOOtwIEq2KKP2WePeyj9wV7/tD6IJJu5EFvlfPo5zJL5UN/2leAr+LnXRSn17zA4KwkP0YL9WFUhzC1uD9234rTKTb+rs8s1KrBQZ34LdDf3o/WBlN9Wi2EVoJ7gTB2BF1HLpgFbUbdB7YRB02H6IDkz/h8Mu5iPQRR1e1iVQQ== 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=cZgqia54AVI+Kdm1/0jPmLtYO7Hb28fRehM2Aoj8kH4=; b=zBFFmU2RXGZGKOX99mPEH0uxQft5nMj1fo0avFdHYuu1iPQ2gT6CxmqfI8U0JSC74F8haq+BfBqys7NyWdO5urdT5hJm8cnjWF5FEF/0bAT1kJrzrryuM573KicpiOXj+UjuY1B927ayHnPqjYzmv3JTST3F9j0IdyKjcKMwD1w= Received: from DM6PR12MB4419.namprd12.prod.outlook.com (2603:10b6:5:2aa::20) by DM6PR12MB4419.namprd12.prod.outlook.com (2603:10b6:5:2aa::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.18; Thu, 17 Jun 2021 15:18:35 +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:34 +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 7/8] mm: add generic type support to migrate_vma helpers Date: Thu, 17 Jun 2021 10:17:04 -0500 Message-Id: <20210617151705.15367-8-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:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4d921e58-5cca-4e99-ef86-08d931a32c7a X-MS-TrafficTypeDiagnostic: DM6PR12MB4419: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qls6dt6MzRhLYoFLmuL6fbvAgvDLEDIDvU0d46CtoDGbreN+JWNOWhhc45yXwF3io12KVm37pojKNxKGd1wvrnrS7jfjc7S8WxBZcXvWqmzveurDfvu8xq2nBd3HOC8UZvkgxz7HD2sbvP3bTFix6nu4PsBtXErH0ta8BxreXHMhDTnb8deKNZi5o1tMjq+7IYQszn2LAUJ/8s66aIgSiIA783dlrd1vaybZf31C6UZQa+PMFRjGfjVpYyQKwIhmyHwLE9b7oKkHAkyKx3RYeFjyZ8ykjMFOGV1LKkswMl+pqaNxprcziPqG5dr8G+IhgEM7AYkp+udKyY8mzc3y7o9bcst+bMC7Q1PIg/S96xbU2kBA0MP9oltz4R24DaGBuHi4U3V6MxFHkYOIvH71+O1ZrebrXrcsk8bbKPelufOe5713QlG13bnXquCpqDsnBZUrXqdVr72zFOKJ0A7YE0fXrF2ENEKeglZTCujZbO2zorALn+tlI1wzAvhROdiemGIvHzg+yywpeO3BrG+z5P/D2ZY06C3LmNxt1cwyuM4VYd/6sP7mFOfihxZXa4Yk5+/c3JD/1ylB+WBJaChJRVTHv+6JulwQcz4tMrpm+RRfbV3pgCGg2xD2RkfNfCVdAMGb8yvk4j9FPVhy/IHimS1DSKVMTwe6Cp3bWQmUIImiCNdEBdgUDwwgKN9nKj5x 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)(366004)(39860400002)(136003)(376002)(346002)(396003)(8936002)(6486002)(36756003)(478600001)(66476007)(1076003)(7416002)(4326008)(2616005)(956004)(2906002)(6666004)(44832011)(38350700002)(83380400001)(316002)(38100700002)(26005)(8676002)(5660300002)(16526019)(186003)(86362001)(66946007)(66556008)(52116002)(7696005)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1OFGwJObpRttQ8uvgBnXwRJSF7WjwNMhdVjeA14yoyBt0EzsUx7Vs2up+GQV4xU5Svv2gIIEPcpxG/5WvYhegFF/l5wM6rGjMmw4494V4QA/EMEQQiOl5Tq1xk9iJc1p7o9e/kt85bAWmpLgdXjQuxXq1BwI+YFod6I+fSdXSU4Iz6k64E/YF24t9TGioDhPSCd9dp6BB24NpU+37WAII1MZAdtQNXb9yVCKuAhdIO0bYo1gahzfrys1Y5R73vmnP+EOXIWhmsPSr/UTXHk7EnbxACCxu/X9uyOkzVLy7euMuMOgqVQL4cLiJQ0EG51CctGQwK3+/nT1mrq8YutS6MgEytGzCF8Uh87Nskorx8yw1yqr1NRfeXVC1+9wC2Qs6aijycMY4KgRnbPN6lI8lMiGZfm/y4R5F/14Cn9/inLICuP/Lo0NdHGBzDVkcZcX4NYYOULhvHXrOVpjJRf2GiHiPYG4QDyUAceh2AzED/JjTrrFKDeoP4X7Le32ABpkVoMHVnvzCxMi2A6erYt2xFdYyORcvg1Ciaxbm9J6f1LcZeEGKPoGPJ0Es9tSLwbHsAjRF7MGZSt1i5np6kftMv29FmWkIjpPR3KDt0JO7sVXGswuxRfL/KPitHz2sKQ5/NhTwT43i05UJrGK7zn7+knKAIlMJbJTNsPKaNc+ZKOrFjk+eGMFyy4TUWaTD5tvHy5Bv1CcMInomQQKg9heey5Y2n32kFMyOyYuyqQnERM0N9kz6Vgq5cZRPa9IUyvs2ECc1MpRx54OiUcH8UJP6AhMxUXG9hU5vGCt9yjU32IH3L2uqhMFXiE8kVEM05aAwxSN5EQDoK6MF4icSo0Fg2hdQrjQ/WryTes7x4+3J9RvlCoc4BSP45J/ayJXZJNYuHmsRAtrS9BhQu2xGQ/yiQEs5nwrbEkOmrc7MGBD7TIM1KUbusADFFP3/TbgxyJsj7Acj6YCoyDboRC2Miz1U3pfILxyvDVuS8pYiDj9V3wEfdaB+9qRwFZRJcHP4imrrDP4Go78aoo1N/XrhBK02+VixrzapByDjC8md3ue2/gk63oMRvx8PVfx5c/V58iujPrn47YxbzLJPNqG5saYe3zcboER3SM5vLZmHoLz2fYFHMds79SNxyG9iXUHiag5l7kDhWnya/CvICvz0k6DaNqN6JW5/npnFN1l+uVD+1zbsODTyyMFm9DiIaX4UDYCyW/FeO+hsHYVrYFtST1ijOoQM7cOg/I1I/rVwtEg0o9Q5+ZsNed7FBthuUBFlewDCboo1SGizsQFXaktQq+gCOlBiuGyh79baVY2ZLVic5quuaW+i0IhzZ2lfFG+M6UD X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d921e58-5cca-4e99-ef86-08d931a32c7a 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:34.7948 (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: g9mCuAFTJBTl9eO8i+COz5SL0nuwpk4G2mybXmDDvams8kQL46c+rhSjya4NyU7O3UMWZ/fJGiwfa8zk7cDKlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4419 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 5FA37200109C X-Stat-Signature: rbndutttmtij4w3sb8qji4pnpi6rhhpm Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=zBFFmU2R; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf11.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.93.63 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com X-HE-Tag: 1623943103-417438 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: Device generic type case added for migrate_vma_pages and migrate_vma_check_page helpers. Both, generic and private device types have the same conditions to decide to migrate pages from/to device memory. Signed-off-by: Alex Sierra --- mm/migrate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 8c2430d3e77b..3b6aaba96fe6 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2602,7 +2602,7 @@ static bool migrate_vma_check_page(struct page *page) * FIXME proper solution is to rework migration_entry_wait() so * it does not need to take a reference on page. */ - return is_device_private_page(page); + return is_device_page(page); } /* For file back page */ @@ -3064,10 +3064,10 @@ void migrate_vma_pages(struct migrate_vma *migrate) mapping = page_mapping(page); if (is_zone_device_page(newpage)) { - if (is_device_private_page(newpage)) { + if (is_device_page(newpage)) { /* - * For now only support private anonymous when - * migrating to un-addressable device memory. + * For now only support private and generic + * anonymous when migrating to device memory. */ if (mapping) { migrate->src[i] &= ~MIGRATE_PFN_MIGRATE; From patchwork Thu Jun 17 15:17:05 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: 12328187 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=-18.8 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,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 A92F7C49EA6 for ; Thu, 17 Jun 2021 15:18:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 45477610A2 for ; Thu, 17 Jun 2021 15:18:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 45477610A2 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 DD9886B0081; Thu, 17 Jun 2021 11:18:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DB1286B0082; Thu, 17 Jun 2021 11:18:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C050D6B0083; Thu, 17 Jun 2021 11:18:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0183.hostedemail.com [216.40.44.183]) by kanga.kvack.org (Postfix) with ESMTP id 8CF106B0081 for ; Thu, 17 Jun 2021 11:18:40 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 35AD0824C723 for ; Thu, 17 Jun 2021 15:18:40 +0000 (UTC) X-FDA: 78263572800.16.90CD2A4 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2086.outbound.protection.outlook.com [40.107.93.86]) by imf11.hostedemail.com (Postfix) with ESMTP id 5404820010AC for ; Thu, 17 Jun 2021 15:18:26 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Su5TomvLxZ1fLt3A8OEwwaWMJJSMx3V3isNQJOtCk7a0CYu9yzZFDTGjjnjgff8yhbOmMPhCr4hCc+1wbbJRr9B5loZxhXUTcU0IUiQiJDMMlu7Gn9ukDMOjMbFwOr4KTB9cIXqtwK5ZBmGViLApZEC8gD7vgYCogRwrRUcvbBgcx7VlL6xs+PfHTJyH6mBhcrjxsjcZVcZStHshLB0pxamIJOInP/sRt5jrXW5KF/Se4uXB+TOhZ2KW1EmFd3IzJPhVc/THfkaSWgferFyerQMtt3Vaj5HZfEyorWapruGmk2bUKjs6UAxoE6clRkyM5M2oDjooOLE/jLpKBLXe+w== 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=fto7oGTXuEchER0GieOzKEfkpiqMw64yv0w2SD6NgAs=; b=lGp6Xo2+rlxjzhL2DQOxUhcYiSnr7iFnekeiPDJ0jjz8a+fam4zSOhtEP0mLfmJmaLNPJMv7YTypQBigejbm3SjU/9ph7q1ODFETa98Ch+oGuE4ALPd+hP69TREtFCM8fzy7kdydtzELc3TYzGM15z00W6REzSDPXa8UKOnYePeml6U10UQxG6/ak+SHlmOkyCJL5peU3SZwNRAhHb9H0Z7g/fh0CyTdkhoT9/Lk6t1+VshW0OQ8JuM5mUSpyZwIDNN8zznkj4IFSJuuOrnvfUnQZyjaCW26BptmmwuT7xhXjOnr4DB1bWT1wjn3I/0D90YEQC3BalCbE3iTm2PmbQ== 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=fto7oGTXuEchER0GieOzKEfkpiqMw64yv0w2SD6NgAs=; b=44IyS0h62j/MsTf/k2bizWLW6/XW6Z+BO5f/xxU5m4yH6BGWlHXgA3hVLMSH5Iwn/22BSHRp5K7z+upKLMFELpgZOd2VuQlwFNSuDiJY+qRn6JjDcrqSuMElzZcJvTBC7d7t0mo7du0MwfQOUmAvGEOGjbZo2yybQzG9Gj0GoU0= Received: from DM6PR12MB4419.namprd12.prod.outlook.com (2603:10b6:5:2aa::20) by DM6PR12MB4419.namprd12.prod.outlook.com (2603:10b6:5:2aa::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.18; Thu, 17 Jun 2021 15:18:38 +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:38 +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 8/8] mm: call pgmap->ops->page_free for DEVICE_GENERIC pages Date: Thu, 17 Jun 2021 10:17:05 -0500 Message-Id: <20210617151705.15367-9-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:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c3e5518-b32c-4da1-8587-08d931a32e68 X-MS-TrafficTypeDiagnostic: DM6PR12MB4419: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:418; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: prbdEARtjiVwmpoU2ubspx8qA1E4h+bBUheQ66S0xDTjsQeXg5IGKoC3W97gZyYtlQ+LDvuVRaavXsVHxx5gEUKtl6d5IDlWHXsuqrcUXPNVZQPmzpinQdLdqTUY3u3WTK//aVrJ1pFyrFvLu3QNt6kmJ1tJNvDl0iImuN+E603YAgfgYEhS12Hm5eDNlCmSWBrl1gayDlUbYmXanLYdiobg/QwWSPKgyrlKXr/d7zxJ18RDhJz2kejcRr3K4IGhVnvifS4NpyecyNFbXGFskruWnproGBCeh9qGvdXVWn6AOkNR+ZnvGW3SN3oQ9WmyelRyy8CDJ0rR5IHabCr3/QdE7Lpk0KvogMjxyfPdHm+Pr3EP2G081ST9SIRjqH9mCX9ANH6JJVu+5MYbJpqW9fLU6bcI93PYYnkUJKNgrozDRalfB7VsebD+4cgstrNRxa3g195+enCN8yuGWPdO6O/UZwHOSfnwGmvNU8ex8tWpUo8XY2zLe4vofJwAlBDW8RqinlHzP5oCl2851itSRUZslFbWvZzEP2d5dun3FeQPUKP+tvMpvtJS5ArV+Y2mCfWCJ8E1PqDyl+7LVztoHksgqonTlRE2rg18Wvm5O/f5WjEdgVvvDHKPgsCrH0nv1JlggOamd9MCOZ1R6BlmsJ2a6dzLmCZHXYcpt20QhgFPl5yeogjUpL7YhZBT97F5 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)(366004)(39860400002)(136003)(376002)(346002)(396003)(8936002)(6486002)(36756003)(4744005)(478600001)(66476007)(1076003)(7416002)(4326008)(2616005)(956004)(2906002)(6666004)(44832011)(38350700002)(83380400001)(316002)(38100700002)(26005)(8676002)(5660300002)(16526019)(186003)(86362001)(66946007)(66556008)(52116002)(7696005)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AEnLH+l5spL7tf/v6XRUU1tH8GsTIZl5pgLfUQvW/NYQ0vVBAr4BvBUUtiPTpTxR9HU/savzt+OKVsbMpfGEExyGeq9RI+Tvg6vqypAfcwYku3/mWuNbpX5nTcBSoNepMzJc3p//fNXWF4jAdtnVrlkJcGGOwwrMtWIp6ey+l+7IaGJJR9muOOeElLQtoLVP3AStoFs3nzKvM0EG4TLgMQBp2Uagwef0pO4BgS0owulkRnljlrlwPFpHmILxXC9uzAiHuYFk57q/7eZoQsZrtObflamWrTDQIbYJfbb5HxEJIrtgQxXUSvOZm5IljhI7HQ2rjkmAeIGlAHQBy/akQCdi8gsNof0fMoELR34mWNz1gy1wR3LG4ZNRemwqVC+I79GRYHgtrdoVRvOEhzs3TVYTohrwwRxmunAPhgLt73g5NJB1me2ZM8adc/LfbIvYf/DuWSEQmOmUqbFopi0W1/irOiyLYf/3rqXHn1DGWwc7j6fN894H76nmWCvYB0l5Xuu8YR40Srhlr/PbAryBB6RCS3Fn+HZO0+ZlRZZ82DKLUNnji89zApK+3QSLgmvf5dhn6V8JrqKhXt1zjFtk+P5Mk5B159MevTVhLGKuh5ql5ZYC64jUQuiqpqRwnqak9WSsBK4IIZXgeGxpKPMSJhTLjudwYP3eU72DaeRrHkdG1cIMtta0op9Welay1orzLU7BRGVDAukvLoUv+b48T1NnsVQ3YOMWx21siKoaoV4UhJvbyWYL5HdH0rLR7QgGYPcuezJC+8ZbUqURMq2J9x2zDqd7z8gecwCaJcDZCRbEETAIQVKLfPr/xVT4YycoP8atLGTkHlvZMRBLMG1Rp3P4wZJnvjJXiRQXQIUZjT/Xr3g1T9EiDK8HF5NCJ4nmP5bTnGyDdtm4hLGnRfcw9NRWdfhiWEk4mQ3oN4Uu4ZJHNXufpagMKGDHu9Pt3L94UiE0y1wkHNhNZAKJHwt975UfV0uusoMMFlLBMn8Ym+fAK9ckvd2dPJMh0BuVnLeSecG9NZCBELr6OrQ720a5QGSmlExLORXc700h0IIdaJj7DdYHzqfb0ZTxwsLUs4lZRkqroi9YJ2TuZkeiZZq2MJtL1rNdC43p6s3LA5OL+eM3ZGrAq1hxUewsO1msibmFBQOYUdaS9xVfl0qRz3cVqQpqsrCDNwYxbKNd8YjPbcr8zme4c9DaolVUyHMGDD1DAM+rcwRwEteM+KcV2TFaVBkS1tO/K6T45KbMf/FLsuUu2pRITin6TMZrGo46MvDTOIBvtF+XfiA9W22OfnTCXRMoMDhfYHTwx+n150NfBZF0ZGqWDnUlUZI5Owl+dJVK X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c3e5518-b32c-4da1-8587-08d931a32e68 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:38.1361 (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: 9XEHR6JOUXkYDVCoTv94a7lxLWnsQfXyFrojKHWuYblJ+gCMpVURrYWdox/aiC+OgeGyhWWDGqqLATCMR1hhSg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4419 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=44IyS0h6; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf11.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.93.86 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com X-Rspamd-Server: rspam02 X-Stat-Signature: dnzje97uuube3uc8yy5ejuzzafwz91ko X-Rspamd-Queue-Id: 5404820010AC X-HE-Tag: 1623943106-784876 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: Add MEMORY_DEVICE_GENERIC case to free_zone_device_page callback. Device generic type memory case is now able to free its pages properly. Signed-off-by: Alex Sierra --- mm/memremap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/memremap.c b/mm/memremap.c index 614b3d600e95..6c884e2542a9 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -438,7 +438,7 @@ struct dev_pagemap *get_dev_pagemap(unsigned long pfn, EXPORT_SYMBOL_GPL(get_dev_pagemap); #ifdef CONFIG_DEV_PAGEMAP_OPS -static void free_device_private_page(struct page *page) +static void free_device_page(struct page *page) { __ClearPageWaiters(page); @@ -477,7 +477,8 @@ void free_zone_device_page(struct page *page) wake_up_var(&page->_refcount); return; case MEMORY_DEVICE_PRIVATE: - free_device_private_page(page); + case MEMORY_DEVICE_GENERIC: + free_device_page(page); return; default: return;