From patchwork Mon Jun 7 20:42:19 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: 12304713 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 8EBECC48BCD for ; Mon, 7 Jun 2021 20:43:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 37B6261108 for ; Mon, 7 Jun 2021 20:43:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37B6261108 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 CD6D66B0070; Mon, 7 Jun 2021 16:42:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CAD276B0071; Mon, 7 Jun 2021 16:42:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AFFE56B0072; Mon, 7 Jun 2021 16:42:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0038.hostedemail.com [216.40.44.38]) by kanga.kvack.org (Postfix) with ESMTP id 7D5726B0070 for ; Mon, 7 Jun 2021 16:42:59 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 279C882E240A for ; Mon, 7 Jun 2021 20:42:59 +0000 (UTC) X-FDA: 78228102078.32.919B587 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2042.outbound.protection.outlook.com [40.107.92.42]) by imf18.hostedemail.com (Postfix) with ESMTP id DE53020026C1 for ; Mon, 7 Jun 2021 20:42:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lrJ6bKNUGZ0ztYGuX9hsPImZI3IYCdeddywq5g0gQBqjSMXhedlW92Sw6EBAojn99Ufkwocr/ACNceEqdztKYRUDtTYn1d85uuabTYDlnz0pH1At5QiK/5y1rsITvZuW5j6PB/0+brxMhoKPaRz2Jv9WqUsC0Cs/KkrvlBrCe+6zmQFbb0dq3cF7HoH2blSwyaCyBQ/PCnlFUCEbHSS6AVqG1YcPmVr50vLfRkjCyYAC4pKwoo6KMsmekQFXdXseuZNkLDhznIXiCzeQoLeQ9NYeq5O6pTH3JOR7F+cm/gdsCA1PwaRbzyOZf9NJNUA7rPAofWHMDZgtK61fzLm78Q== 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=Veu5Gzl/Oa8o54qERYdlCjbYjBjIwq67BZ+ihmUZvdM=; b=EBBTrScJaxlzZeYbFeG9DNfnc3F4qMMf5Z8tVJoZvvffhCSN1/i0455qI53cK6P81AlD5iLfrFVm91q4Ql19ADst77DA1ZOnDQ9Hi8wSAmMBKVMlRccnGi4sVACdD6YVkQVSRDN1R02NnIE1fSWk87L3a8hio3c/v5ybBitbBK2S8g3didB2y36F1XqjAM10I4sHgqVD8i17kdNkpiF26eoJ1DUs2g6Q+OXqXob79MnoUqBFXRwHuVC1JGtpWcRy9pmk+H0H2X0VamhOnmXphx/m23NBXYRbHMJ8US4q7Q46t9wkaKfHzNkg32Cff1iL9wZVpYr+w6DQdeeLux8GZQ== 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=Veu5Gzl/Oa8o54qERYdlCjbYjBjIwq67BZ+ihmUZvdM=; b=KjAVu5wRgwrPNuwC03kKZEEryAmZ2IyKWknNkP/ZjLG9z0Hs04Ay1+pIBO2S4o5+KuMBQHL4CZ36eaM5X0Ay+w8kxcUjheR0JGKx4FzUGtlX8/IyCpB5tkpROcyDQx+64Q6ze6ZdEwUJp2SHAUPQAynp87nq4v5IFH/wMf1peF8= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SA0PR12MB4495.namprd12.prod.outlook.com (2603:10b6:806:70::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Mon, 7 Jun 2021 20:42:39 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4%5]) with mapi id 15.20.4195.030; Mon, 7 Jun 2021 20:42:39 +0000 From: Alex Sierra To: akpm@linux-foundation.org, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jgg@nvidia.com, jglisse@redhat.com Subject: [RFC PATCH v2 1/8] ext4/xfs: add page refcount helper Date: Mon, 7 Jun 2021 15:42:19 -0500 Message-Id: <20210607204226.7743-2-alex.sierra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210607204226.7743-1-alex.sierra@amd.com> References: <20210607204226.7743-1-alex.sierra@amd.com> X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) To SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from alex-MS-7B09.amd.com (165.204.78.1) by SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 20:42:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 308dda2c-3b79-4d61-1905-08d929f4ca8b X-MS-TrafficTypeDiagnostic: SA0PR12MB4495: 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: M7nvuR298RIzDcWFqORjdy9cxBg+vfh3A/zMlmIrBmd03Pz0OhpUaXQ0BzzWRIfIqw72w9d64AvCtBWXuoSpWES7sawb8O0da5Ssy5FykuFLhvPWYAEi2cAr1KsI3MB0G33Wtd3ciUkRfsakCYYsH0Ja1LWF+En5au4SznarcgA/xr2zmWAgDtNL8963PR28FUUO8vuHusXoNSDVs2XqKagDvjvWNtb0KhGzhMZdfMG3VTbJDZoBYayjlKYuBYOquc8hiuOAj68rjfJV/7b3iOXms47+9epj0QqZwXc8dMW6qF/KNj5TjBkTBBoN3B9Y4WrDeGoVBjLl1wlnbQuwuo8yG3BKm9S0bmq6Q4hYbwxeNxXkqKyPmm3E8mvklmBuDpX3iJm8DaWxqVca7thBY8962LxZeU2u9zoW0f5AgyPRm5rVG1m6O/Gk8T8pXt9KnlexFNDEkFfBZ5p65SP9Wj50NS+foMihHAiLCLw/wVnrIba95jKhEZ34CNanGcPlemN5n9y7aXdceJbGKDIi3ZsLefnCvpJ69NHdO56o6DElld6gU32ezcmqb6qviiNZHA2sSkXG+rbvkuwvqYfFfeTh6tJZZUx5fHKb7qbcSU7CsChXMe7nFcIgnL86U0RGUQym6bar5OuomSm/a9kLWG9X2A8TvXcl6daJ5mzaLeM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR12MB4430.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(136003)(346002)(366004)(39860400002)(396003)(956004)(2616005)(6666004)(38100700002)(316002)(26005)(5660300002)(1076003)(2906002)(6486002)(66556008)(66476007)(186003)(4326008)(16526019)(66946007)(44832011)(52116002)(7696005)(478600001)(83380400001)(36756003)(8676002)(38350700002)(86362001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: eUb5xnD0Vi8tB9i846WizgDb37neWXUcAfp0Rvro0yidV2oRa0Yq2L0x3nVxKDOvxcVAU3L/7/HdxKBQTIklO6GZD6X4MDlho0wDNS3gZlaaxoqSFM5OxwxfGaLCBlN93/fAoqAzXwbnK2gFi9gw7JFBUAOc3EefOZHyn0s+bbAqIEf5zH09CcNxUzJuP35G7e2kNy5hdMhtSiuhh16gYRr8ZsNj33aOBpE6zzm1Vidq9LMI20lS6Hzb2UixSsh8LeaKDxIZ5M14R3DTaEtbJze+Uoj9hVI0955v9tgLPjr0pSJGGKp0zUwknwAzVn3oZchlILUwSKOOUUBMw2T7Saqx/t+EGZJwwh0aLkfBTqx89j0Q35Y2TBcX3y98LEuk9jHJOhphmLsra6jiMj4HHBUGeM/DP0PNSs1miPSCagRpWaRnysa0owa9VGqrrDN7FgUOHfh5msY4Yy1b3NhJiDj4wkcrHFLskq320EUN3myWvjATze/jY22p/4s2afSNVRfTGdOn9y//7hr8fZ2A4Eycy22k1L0Wm2XSZzMWrveJ/gPxJrZe3PqL6z5nExAiE4IIjnFmskH+M9EdPTv09W0pAk+0TGO8wdMe9jMR0zlDvJmpj+doTU4rn29UcDHOnROiTjGCGd0+4QYLLH+srKAOWwlvD41deXIZhDPBvhfM26z/vft3NYEYyTVfaQZnfYtZtMEFKJVwqtEGgUFooQ+aFNHCGeFeBOUibLSoL9TwjG0opv3BA94i1C3KHngThcR8tm/sssdRwcgb3gH2j5Wi7+6SiPC3sdvPFy+kt0dNsm9vLOSMHL4RqS9XsEBUlG6sW9yrVPTfweSBhw93HVjFKXbLiN873EJFd8SZDuWKtOE9fp+Do0wZw2bmGblJFyy8SbN+n9gF7B/LyMsvIQ/q+sWbYlJ5YYEC2vwbJcwBE+ZZCOIY69GITXk1UFoaIXJ0iy04YmDkrMSLugXhtxuUCSqqjk4zSJWwOWzXPwNgOGn7IzLsugmM+/bcvYo49fDI47ML/AjVrdUdicf8xmbrTMURIn3vYXDUzJyP4G91HN6GRV2u2hK4zS0wR9uNCv0bP3CXgPG82epFwz/xjjy+7s63JWQMIbHwKEgAvExZ3UGQxtnpphGEBsANDGqGC8bRFBd2QXGup8ScqpqxJUPmIsd1Dq1IECPqZROph2Yl1K1SBIZ9FkKp9kbJcYfCKwXzshEStbiBSHi+3kOeop4SnAzmdzUnttAVrj/vPZw6FIOyqloPIk1UEwYzthYC0bGJHmfyZ/DscHl2eUyzQuBam7lW7TSOwmpb5qn4+ha+PrLUcHoIinRcU5ouNQOB X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 308dda2c-3b79-4d61-1905-08d929f4ca8b X-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 20:42:39.8151 (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: +rwaOCDKlpltmqOwMBv0HFrpn8B03fAy9MeeL0vUkZuR2cOuXU52tAJ66AwnxlAXZvmu6TmMd3sQ8s9w/N+6uw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4495 Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=KjAVu5wR; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf18.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.92.42 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com X-Rspamd-Server: rspam02 X-Stat-Signature: jkwb4u89q5s511fy8sifc696r1z4j8nf X-Rspamd-Queue-Id: DE53020026C1 X-HE-Tag: 1623098573-155627 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. Signed-off-by: Ralph Campbell --- 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..8909a91cd381 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_layout_is_idle_page(struct page *page) +{ + return page_ref_count(page) == 1; +} + +#define dax_wait_page(_inode, _page, _wait_cb) \ + ___wait_var_event(&(_page)->_refcount, \ + dax_layout_is_idle_page(_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 Mon Jun 7 20:42:20 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: 12304719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=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 E1979C48BCF for ; Mon, 7 Jun 2021 20:43:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 85AA361108 for ; Mon, 7 Jun 2021 20:43:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 85AA361108 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 276956B0073; Mon, 7 Jun 2021 16:43:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D9BC6B0074; Mon, 7 Jun 2021 16:43:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF94C6B0075; Mon, 7 Jun 2021 16:43:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0023.hostedemail.com [216.40.44.23]) by kanga.kvack.org (Postfix) with ESMTP id B652B6B0073 for ; Mon, 7 Jun 2021 16:43:07 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5F5FF8790 for ; Mon, 7 Jun 2021 20:43:07 +0000 (UTC) X-FDA: 78228102414.21.B8A1655 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2048.outbound.protection.outlook.com [40.107.94.48]) by imf21.hostedemail.com (Postfix) with ESMTP id 677F4E017CF5 for ; Mon, 7 Jun 2021 20:42:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=krY6ucNhjOEYKRrS9FIyD6ZYYusuxaRq3Pns9Y4prZ3TVp3nctfzk28u5TJujGYdqpjoWSn3Bah57zgAv9n73WcCfnl1nWNA6Yw/eQ9PxnapVaD05gxpFhwVwn+AQNTj8YdD6TyqvR6KIBSFtF0YNbP2l0pAcEgs7lkQfA0NFKNThRT6LShy85+tvPy912gMW+Ga6WRwJ9k9xyUBWhoQFfqPcL1lB3XAj+vFxXhZZzvFj+2HMiNWbhi6gLdZupFNHLH8p7oMZeKNGHR7Fq3wOxsw0Tdu4APOShXvxmLhlKjg1D//tm7AtuDiNrcSAJK2qVlESl/IiYXeitIHxk9BUQ== 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=+Y6by+cj+a5kSxkkXciWS4gzS7j6Iew/i6e/lGV+t/Q=; b=K6A69cgfdFLv/yZfYbEKr4DVNpNU11sQCWvjX1oFe8mmC5purFkFvyuJmEDjwM2/2Zl6LTwuOvo+KSao8pxJcYb/vC7B6fbjGbp0/rpOduTQanWRGWE3A5ZQBPgIW3YBWNdhdYDsomL9X2adbOuJM6kW8lIpFjUDrTwuKr+RmLOg9hIxNb2LPLRt/lnOiO6cIDhaLggxPbrRRsp07z02BjdmLL34q4cJtplv4QxJYScN+uff6CSkpzayWomaAMQ932qfmcwtBIHrsvkIdfCiKCN6bb5uca2nfHyxpnwFIVkJbnZREdQ99OfBELBZqpTsdLTg/mGvbV4E2lK1ar8jyw== 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=+Y6by+cj+a5kSxkkXciWS4gzS7j6Iew/i6e/lGV+t/Q=; b=qLMqc15xlGSy7lyO+vyKDMSOKw0orVyPzoI/jvaZs1SCzd+dnvkyT6CTuHH/5JIVblV08jIgJzx5jdiTM9FTKAYD/DcEFsm5wpeeZisnFtj58EgR9JJ6Tzj2gdU6q2wrTZ5SbRKkNqHd0zo0koSoWuR2+T0oE8g1t9PJaGYML2k= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SA0PR12MB4495.namprd12.prod.outlook.com (2603:10b6:806:70::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Mon, 7 Jun 2021 20:42:40 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4%5]) with mapi id 15.20.4195.030; Mon, 7 Jun 2021 20:42:40 +0000 From: Alex Sierra To: akpm@linux-foundation.org, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jgg@nvidia.com, jglisse@redhat.com Subject: [RFC PATCH v2 2/8] mm: remove extra ZONE_DEVICE struct page refcount Date: Mon, 7 Jun 2021 15:42:20 -0500 Message-Id: <20210607204226.7743-3-alex.sierra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210607204226.7743-1-alex.sierra@amd.com> References: <20210607204226.7743-1-alex.sierra@amd.com> X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) To SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from alex-MS-7B09.amd.com (165.204.78.1) by SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 20:42:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 03884221-d9dd-4b52-883e-08d929f4cb00 X-MS-TrafficTypeDiagnostic: SA0PR12MB4495: 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: Ssgw0FocgGrtLADCtgqkPyBeRZOnYMiy+nLWmZfYHCtEfbH7cx/l/4fMw5c+FF9cyfsWS6z4jyezriiNjjEp4T+gLufNM4ZtZ8O58wLTggkHl8x79MW6HgMuoMtknaXfS7/yUxMLJP2WPzogfIDqFD6QOj79JueCDGDNigIUAQAgWHYWZ5RjvJZ/CmgQZHl+A8+jkWjV1qa5Wpyt2IvoFaNKq1XLyhvG9nB5Ip7kU/tDUKQRv/Nfp17f9Sfg8C10MFCJmO971QJo3t+hceLBa7EzDmaY+VqBl5DejdngXGQx7FFMiw6ay2KTIHiE8eqeXZ+p8+hp/f71ZGLfl8b2uD/m5yPfAlapldU8LCB1IY97wWbWQKb0SThVOV+UhBSsd4bV4LoAv7cMCMtW0tv7HsXtpeoCztBSnVRkvrxCLuxzGmErCJC9IXklaIOa7TEbpwojBWn8OhxkS55xg/3SdYfo40vjrOKl53ylAxFa+u5u4quDQuDUp5ffcwO+uzWcqlxy9Kcbn/4HGQFVIgQ/PXKFMHF1BibH4sBppw8LSwZrf7IiusOc7JzUSPZoIzOI3Iz4aRjbxoniMUxwaQJKXb28HlWxxlWmWEqw4Kt+Diffri0cLFpcyhwLgm8mNjxP/zWFcEH9uY1bFbLTo+ywCONv9ePoHLxlpNdUD0ZhTjQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR12MB4430.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(136003)(346002)(366004)(39860400002)(396003)(956004)(2616005)(30864003)(6666004)(38100700002)(316002)(26005)(5660300002)(1076003)(2906002)(6486002)(66556008)(66476007)(186003)(4326008)(16526019)(66946007)(44832011)(52116002)(7696005)(478600001)(83380400001)(36756003)(8676002)(38350700002)(86362001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: X9eY/jnkJ3WZxKsvP3XU4BxddkDM7ISwRBzaZJpVTJ7hHxYHJjlrEbJJFoWCZEqojXKnqoB6YQj/SACbDJ20e4eAv9Af67jktMOIMEJc9P4YBeHyvWwFvfXi1t4Gajs3sILefLTUlsVfVFWPl1gLDzqNOEAhSvHxsMOA9SAUCL+BJExpk3hTViQ2oAg/z/fR/BWbCKulZ46QCeFGQ3sgAG34xbZM6j6OP/v19QbUODfF/V8/RPcvJH9pFtRxKJ0aVhqEBxjWHLRa6XDVoM6HlMmird39glUJGVDhUzrjm0ocfbwCB/oaLdCrWbtcCKkTi2mEAAJ+lLIpn2dsXANXwuKOmqrbYVt9tMkIceLbtI0psFzMGiAU3qSf2yVYCEJra+9KFYqaby0vcOajmpzZvRZVa4liqsIli0nv5KGYURgm0TFInHUTyQ+4SFTlxBQ+mbG7DctHu1a+9cm/JUNREIWGl4anI4WKUqNZsEcrAoqUSUnmnm6joFHPItkOgpMNmus8p0YHy52CRfMsdHhXl06ZH0z1x5oDCbDQU4jDeCY8ndKI8fHNzGIMkuw5DheZNIZNNff3Z8fqBAXkHzl93I12mntObIh4dKv2QYSi3oCoP/8NCWEXeSGy2fKCIXyjwq/sCqa+SC8ZoS10xFXLU0WQPPSIYk4GPOvN2ELvNM4poW3uOn7NVHRNGO12I20WxVXGSWdNV0G1x6gk/wWzaQPdKnN7bOIefJskTEQzNCZnEPrtNHITp3mb5pif2T/RBmeA/kNpAjYzC5etNe55VA9TUPRznVFw3ut9YM9kZ9SQrrca+2wXv11c4QyutgUdlV94S3sqQqK1Hp+pkWU07jvgLJ8+sTkx7mxeMu1Srw4v/JP/bRSATfqbrsRs51ZQQf0XXFzWunDHOrurZyTUkj6qiAP+NZH+yEXiHHsyLLokxb+G/xLadDIVy3XkaEG1oj7CeCzEYiLzzjgRopiyba9RUppHO93S280fiXIwlqFVTiqeKGrkabi5udkEeCgCrwZlFUWVSN+Z6zZaJJ71EkPAMYBzgFhBPhemztQZM1g7hQYgvPYdbNFAVerfru5byFLjFmVCCQcLPSi0ShPMZ9WazYdUMDiUYEwJ6ZfBqRdCCn0JPabE28zXh3iVLtQRHrSYZGtAoixjbMZA/hZQuUtDJgUJl4OtvT7JhlxQbSsS352iKz5/+dV8sKq1uuv3B6iNUQhS++qeNZizxNFp36CoWVGyMCffnK1fDUSeuEVQha9Ji2KHach6CPaxX7CddKCcKWa5qL/nAV0WeUfdAQQpuIyhDUcvE82gnyWnanpjRoPNdtM3Pg/mm0ziSEqw X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03884221-d9dd-4b52-883e-08d929f4cb00 X-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 20:42:40.5827 (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: Cj+unjeU6ncObsiBzeD09ZKhIH/EwYCylrdLsCydnwxWqebGtmV2j7nz5jLytAcQfBkTcvde7wJ2nffXLNZ1gw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4495 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=qLMqc15x; spf=pass (imf21.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.94.48 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com X-Stat-Signature: 7np9du1c9zk1rq5fh1x94wjbi69hs3zd X-Rspamd-Queue-Id: 677F4E017CF5 X-Rspamd-Server: rspam06 X-HE-Tag: 1623098567-586797 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 8909a91cd381..9487dc06b220 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_layout_is_idle_page(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 Mon Jun 7 20:42:21 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: 12304741 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 9D05DC47082 for ; Mon, 7 Jun 2021 20:58:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 41CF1610E7 for ; Mon, 7 Jun 2021 20:58:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 41CF1610E7 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 DB2386B0070; Mon, 7 Jun 2021 16:58:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D86876B0071; Mon, 7 Jun 2021 16:58:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB29A6B0072; Mon, 7 Jun 2021 16:58:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0202.hostedemail.com [216.40.44.202]) by kanga.kvack.org (Postfix) with ESMTP id 8A6456B0070 for ; Mon, 7 Jun 2021 16:58:21 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 23D111181B for ; Mon, 7 Jun 2021 20:58:21 +0000 (UTC) X-FDA: 78228140802.28.071335B Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2084.outbound.protection.outlook.com [40.107.94.84]) by imf12.hostedemail.com (Postfix) with ESMTP id 3BF1D1822 for ; Mon, 7 Jun 2021 20:58:09 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=We7gtbAzR5a8GcGuaDbH419c8PNERooEcvJ2Lt1ghEQWBu6+eWcF9RHx3RV/3ln3waOU940gMEGx+iWm+Ojm02NYADx0VDPbZW8xQ4Z/l1xiIRz5y3Qseg8DZGJFZGhdIq9cYFRRnQEiwYJk1GyU0XIl8mUL9dssmIOMZuF6Htmeqa6I5VpIj7+L8XFbQvvdRoimgRR7/mZXhffptYfpZpulc1F+Ng15ZeOrCbDMsmK0RkYED7AIyzIf23eRkU3eiQMlx6Xuy2v/4ppOapDbmniy509keXWlekJ1z5jIeL16M0kSx3ukxhwJmL0A7Tgo2MDhPFULRVRna6Fp8+uZaA== 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=TfNhKx/u2rJDt4qkOFZMJytXd3ZQuF8YrgBy+DStfCMSQQWxQZwC7m++IEyNSWZ+3hUXiAYNFYdkfgQYlWffoJkTHUjOHCjvzW9ffK6w0+CCVyd0cGc8ukt3TR/uFdvD1apsDRj3hMlfpIQYwdqy/lzFRzm5dsIBFUAUj2YKNgLWl/pn/HT1zn/Y3zMbCEjMgI7mcBIObO8rSi+oI+4/nzWk6cyoHIWV3ARjt5C6Iz6v6gQdxD7VBCS+h5Dv3RDdzWviNQFp7x0iYcADhvYKShCVxvI8DneoUa77R1wA72Gq2gFeFrqPEHHlLJA/QOJbnHg9cvq6N5sdVK+bk8E7tQ== 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=YGlMBJd48qCmf8GN63ebWc86Z2bwM4S5W7YIwyGdf1WrfvQPcGNqYJmIo3f+3yhWZ/ymhtjs4OwdDLVuhUmoK5QF5BvvyeX8ZasYA3U/I5OdEay76blJD4VzYtb6NLBp10C9K5pOW4gfCLaomkT1Zmnfh5svHZXsIlQTgsd++X0= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SA0PR12MB4495.namprd12.prod.outlook.com (2603:10b6:806:70::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Mon, 7 Jun 2021 20:42:41 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4%5]) with mapi id 15.20.4195.030; Mon, 7 Jun 2021 20:42:41 +0000 From: Alex Sierra To: akpm@linux-foundation.org, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jgg@nvidia.com, jglisse@redhat.com Subject: [RFC PATCH v2 3/8] kernel: resource: lookup_resource as exported symbol Date: Mon, 7 Jun 2021 15:42:21 -0500 Message-Id: <20210607204226.7743-4-alex.sierra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210607204226.7743-1-alex.sierra@amd.com> References: <20210607204226.7743-1-alex.sierra@amd.com> X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) To SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from alex-MS-7B09.amd.com (165.204.78.1) by SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 20:42:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0a704f9-956f-4e97-75f1-08d929f4cb79 X-MS-TrafficTypeDiagnostic: SA0PR12MB4495: 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: 4E/OYJKCHRzkcwSnt6QFWPDFdw1NgvVNBXxn04n6k2aalmoVDz+cNgQF8o5zjUcoqfW3hjZ4n7j9LoIxKjzsoRgaBUHP1F7i0PaaVJzEi0y6dqh6ksw31nD8pv6c/fehaluBUzWJbdqCFWTwpgbM1VcyZFPwYDZWDrCEXThhJ+KWpu6d/iDFOImJ1KBrv8Nj6s03hx22NLmPqiPtoaZCCIjy/iD5lO+xM3veN4OCqP8LnY7KKIskMnJ7WtB1QFInmEAJgeIP4vuoITV1E8fNEu0Mld4/JwjyZ1t+XwmwZZJ8Bvh9vDnPYabdymExJIHYcImOxSfXxjDF2O/gk5xk6WVp9nfWaiv4q9k92Ak1st/IdDu2LgXbWb9/RcE1SmRFAtzeP1ypuVPbJ0k2lGYeqBQiSuLOB48KRuLGkay3bWEENCGtUUnAv+46NwNCiTxhdAW+PEA1qPjcHAnF/OphiqGytryyU17/9xFUs+xSaFmRpit+xvzRtQ1RMzPcYm0C87OW7q9dRoo77bcoT383YUZ7Yi2QCChfLeIvh4+mHLK3l8d/zp6IS96UnqizgHUyhITKWEOHhNXmBveh1vwGUlYDbbbNFISC5xQFpvcrL+cY9hiq/IThUquAFJ4rf1uXgTFWVZmcEZ2WEQFdetCwBYZY+aI9HwqYV7tyGG/HnA8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR12MB4430.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(136003)(346002)(366004)(39860400002)(396003)(956004)(2616005)(4744005)(6666004)(38100700002)(316002)(26005)(5660300002)(1076003)(2906002)(6486002)(66556008)(66476007)(186003)(4326008)(16526019)(66946007)(44832011)(52116002)(7696005)(478600001)(83380400001)(36756003)(8676002)(38350700002)(86362001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: juX3muZuYFzxjg+Z5Rcm8TsdBc9OIDKt0xfR9nOCHHo+0jxNG54UTCje1kDd1djmoIC1fJNRKNdOQjDJDgKMsiGCMcg/WZU6xu5/W1awczUsVLRdT8yWBNgnNAO76gaPDM/aEHlV61VeIs6/8MVKuTKOjIbimSLrbOEZJMawK8XX5PHvNk9RnjjBrqLaejexXB+7Vom+/Ve61DeCW90rLT5z7Eoq7OLjqC5CyBU4aegyiO16hmHAGFNdZezXIF3Ql4KILy2mWoxgOaMo8a3dAjdssbwEBHMuzijUTb5iNY3a0tyi6pmzqXVFX5EWdLz9hb/7SASPdj2WizbiRHRYxVGyE1QPy/F5OZpK4WMf+ftotbmtAl3s+K+JIYrxn0+eiq2PoD+mCFk9RYFkwu2rsS3V8jZwSEw8+QTN130aEhW8uNNdY/LPhATG0g6erMJAG8IYgpf2g4ON8NIL+etMTRT/w837FHLi/30AUflqQaoFDi46hCN+QzjhPMdgoci7G8fMu2z/w1FC0ao24O3muJFknmwTbBIJyf+vLU1At0NBz5kKsvo1zMB/OTLT2Cx8OWZWee9Ug1kbk811hut7XDY02pcW6K384XuD87qO9skG0yVgowa7YmQbYP/6F761yNAXHKHAmvjoMpkeOVJldHZThDXFh2E9ax9aOk5UVwYtyKWd6tm66WV0aGPKFNcWpKJ1VdxBwywJdFhUa21KGuJKx3tlkehLDI7if8iGZaRUu2o1Uo7pcRnPfHC0IpPKUIdvnN+dVIP2AkpncOTujtu+a+ufV3sCl/PEU39EQJKoG+wlhjHflFiZNdk+NIgdi0jDAFVUbYhDcUVGH3gyjtNY49865HWOtozseHuEOjnV2kQZA9Kffw9p4ckX0H/MutLiy7b8CZDgNhgylm6xTCxih8tfrzmKepESue6YyGbN3XgYnvZLzScXf6ZWwIoDLwZixqHKe/vTCOwQGcrum3nGfguIyNSmZHB3oVegYAYqCgVMXhXoMnU4oCdEcjfH+N2r32MgDvksk535aMkYnvs9lNEQ1Rc/Dyrlrr6uAeTBCfQWGyd4wTslMSjtigy9Xhl2odkK365+IqRwRrPwHbvacizGkYALYro8uyyH3TMv5otauBHb5NiRlZbgZ0Mt0j2cFEt4BTZjQhKKhteUKPNdNpnswg488P2ku+ZQoBFRbK0OvwFtq4U9hTjTV4fSC1X4vcj3FS9cRF04XaEGiPU/Jg0nST5nivOu040x0qB9VekgE9Z+b7O62p/KARXWf8/+kL5j/ST8/Bz/CXe3QJqGOueIwPihpmMR2QSiopwLqOKIkB9fJuCsOQ3TNw4n X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0a704f9-956f-4e97-75f1-08d929f4cb79 X-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 20:42:41.3404 (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: a+GvFoiuZbUoMFsLuLEQ0+Kdkyc+pS+JnNZ/3ibJAOxKmxVQRXEBkVCH9Kz7SFKdEieKP8YxuyBdvTlr2uw9jQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4495 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=YGlMBJd4; spf=pass (imf12.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.94.84 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: 3BF1D1822 X-Stat-Signature: khwc3wmodgwrdm4dhhz1g6gdwjhgjody X-HE-Tag: 1623099489-266129 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000009, 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 Mon Jun 7 20:42:22 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: 12304715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=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 CF108C47094 for ; Mon, 7 Jun 2021 20:43:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 83B6860FDA for ; Mon, 7 Jun 2021 20:43:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83B6860FDA 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 2C3F06B0071; Mon, 7 Jun 2021 16:43:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 29B886B0072; Mon, 7 Jun 2021 16:43:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09FBD6B0073; Mon, 7 Jun 2021 16:43:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0153.hostedemail.com [216.40.44.153]) by kanga.kvack.org (Postfix) with ESMTP id CA5D86B0071 for ; Mon, 7 Jun 2021 16:43:03 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 60A8B180AD807 for ; Mon, 7 Jun 2021 20:43:03 +0000 (UTC) X-FDA: 78228102246.12.81E1A40 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2042.outbound.protection.outlook.com [40.107.92.42]) by imf18.hostedemail.com (Postfix) with ESMTP id CB71620021DB for ; Mon, 7 Jun 2021 20:42:55 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O7PUE39ZS3chl0WenU/WLe1NHk2fslhY9cIuPFNI5lM4Ve1RL5IbtRl16ex2DXW/3Un/qGoVyNwod6sthCwjluAGXmUx9rz3FUrAPjM3f/CkC0TfvUVhRNi2XaYMkRJXZ0ATd/StJLLSYctcAKuDnClJ0SJ2RrKf55Q8LQgViZZo/yJf6drqyTylUsAGq5Ceg1eUlENZanfLOn/a53ht9nuvUrBXQyys0mcmw+6NYhn9EaUNbrgom8Y6jfSGQ7LsBa9RDqUpGeXkteRb0AfGHgppkSbY/7OMdQG/Pi2hOtK5IBXQJ3wYtaFgKH5nKyWBXCmt9IhB3UOjysxTbuQKuQ== 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=AzeqhGh29/0IpMyXym4tKFczibYwXTH8Cd0vkIKPT3OaxvfSw7o1hYas/BpCYVbaFh3xwfF40/ZBTHoku36TpTHdJzwqFTf06QX0q9/XAzQdDGaOK+rfhOseCZbAc0qtc7Wrar4S2ypVu20fXOomUr6UrLY4//ba5BItaMU8+etebEU2PQ+vCyUn6fsD0el/aaPxH171FxKnOw+eFnNAYc4u+95u9eBcp2ZscuEfg8GIlppTdftF/O2T6h54NJy4iXijLy/KaIjzyCD6Yo9ghVhTEX4IMa73UAWFnRoZxn3kq+MJ5qbjX2OMHTcNsrOHhwKFzBQMXMO2icHKwIuhUQ== 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=Psx/gBObQk2SQcEwMeBJhEfrvFiL5FzdX+EoDNp5KmAOfN87khMJs1tmsg+os4z3ewXjsGUyLVkOIgKpNiM8wyTck96KOc6aw2uutwTaeW7U2YFHZx7RYfYVdPRqY7bBSeMOo3zEj/QGYWKuLeRgFr9jpJAWqDGJjLi5c1C/OrA= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SA0PR12MB4495.namprd12.prod.outlook.com (2603:10b6:806:70::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Mon, 7 Jun 2021 20:42:42 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4%5]) with mapi id 15.20.4195.030; Mon, 7 Jun 2021 20:42:42 +0000 From: Alex Sierra To: akpm@linux-foundation.org, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jgg@nvidia.com, jglisse@redhat.com Subject: [RFC PATCH v2 4/8] drm/amdkfd: add SPM support for SVM Date: Mon, 7 Jun 2021 15:42:22 -0500 Message-Id: <20210607204226.7743-5-alex.sierra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210607204226.7743-1-alex.sierra@amd.com> References: <20210607204226.7743-1-alex.sierra@amd.com> X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) To SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from alex-MS-7B09.amd.com (165.204.78.1) by SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 20:42:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 04c3f474-959f-4b72-3d35-08d929f4cbfe X-MS-TrafficTypeDiagnostic: SA0PR12MB4495: 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: NKLpuM2POiMNAaV14RV8K+k+3zjMI+oRyrb3qrK2jTWtTquRInBbHzAOwZHvciu1mAfu1JV/FY5BlVtmhLnhYqLEhcO7acKr8BZw8T6luu2HW48E6EVzeFl7yXCQDMfhOYAYYG9WSPgDxPn6aEsGEYMMv+PNfJm3P+eHaIuUXNMhJnyhyZnn5Y+d6sGoVucJ0W/76BDZRxpGVB7ftdlkb6GEqXT2y313DweMc4BtozPu3XIQJDMvH3MflfNbcMQkC4tK1AcoQq77fwuKnxiNCDlPAb4dPtfFxUU+DP6nrFnOUKlzlmR248X/9SssQ6aU7CxIKFI09JT3tUPosG0kBfCmzxuAH+yKvW4B0F/PvzVaHkx/XtEPAppQv6ZBXAyD0c4iwYYiW5beqkpxm9MrYbXPBltP7YC/FasCA8f+pVqASBulWGfYT1GCsI9Y8PBsLZONMKgSBLc1G5sLLM78Lo4AjiTGcXSBmnMtg0ziyWcWqO/v+QHAYCFChSHp6UYqChmWMRoTLEMLz3+PxeziokOywoKrkAfDxTfUkRCjSetRRMV9NfPFSnSsl6ObVS+DhTLsini0osho629fG+WIpcbJWpCQiM6fSDAdXgLQBB5ZDmTdmDZu+b9PKp62FwkgwbIuJfPfyNupNax9zeNThbtOvnhapZXAfpbswEgqy1Y= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR12MB4430.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(136003)(346002)(366004)(39860400002)(396003)(956004)(2616005)(6666004)(38100700002)(316002)(26005)(5660300002)(1076003)(2906002)(6486002)(66556008)(66476007)(186003)(4326008)(16526019)(66946007)(44832011)(52116002)(7696005)(478600001)(83380400001)(36756003)(8676002)(38350700002)(86362001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: epmZH7U/yfTJzcW1bZx8S0rRX4/RpvB4paSc9+8KTZ2CxBd3EBOwnVTUXA6qMZPsPfO+vMJqPAizFOFkQSFtcq4GN5fhjIaXwacye+hN4gsl+hcdZRHwwEOCiOL/j2TJ61p7+5HYsmehj+lG7UnW2ZzOOn4jH8g4Fk4iKS+NXD52uopUf1sJdmbivYuDso3qaa7HE86uRsllzapwXNjeeFM7yigkGvPncNUZQDozTHKnOKLmyU5Pq30zxlNWGPEuOPLf+H8qbvNfcdg1yyjJOtqgvDDNrxFJpL3PYqsT6QDyMBLeR6Aez675qZgm7dTNCVymNbacSp9X7J5WYssyD8nqyFqSIbwo/Kbzn8Uc6x4L7Mh2fkvjwVvgxo0satnm8yuF622chq+udVRc76+bib4tSZGP84PMxy0NT81U5GnED2w9Cie9s1chz6DZM3JAMzILLkW4yxryuB5NQkgV59kFSSxL28ii1a8JQ6tOlwAc1KJLEGPWukzs3x9ZqHZ68/RjiGSgqPi94SybeXDDYVazEtQWTnzG4HknopLPPQaf26aIJ9WGAxY7pYfpvQBJ+36VU1hMtCnH/ETRnS1lx+g9NF8HmkT1SxqVuy/SeSWBA9XO7ByQI/PmGt2ZBnrpvNUU6JckkWUr68VyM9t39+66qdqsvzhrtIaJgTuOnGNa33aPnsrw5ERxUBr8wLJ9twGMeHxTNDgq0XrzbJcyruouNybpX/9L1vWnr4hkAFFnGv6Q9QPP2qpiMee0rTAn9Wr0bMnV6PsgVzTiXXt8iStCynIBVTYIL6rAgJt+mOZMzJcR0HlvzJvcqnK+uo1Cn3iwAvv9Wp2V0nKmrpr4V5EgsgyAskH0rzoXj5NKG5XM1vIrZKdwIQWHCtlYQDs97b7/ZTIOV4zHHWK+hPCfdk1pbxJBO/yl4CgvxQt0A9UVVpFp0slrVpmpkuOPI3N1Zdmv/STnca6REtKoigbOidJh1/YODY3Sc4ffjgTHxJssFh2K4xpYbhppJWeKn6TR3mR1uZ7y0victSdAU7FjXO8Do8QvHWLa5Y1kBN158qhGPrS1mMMXLS9b+efxFzsnhl1D9qpyQXDJrDxLHZ7aVkhryAQ3HPt0EGuuGyHq25sYTB6BDKoa/Okd7fcFQi8Aaw4kSCQI/cyxtWJNBmq6kanWPEZ3uKGTEVwiJB2ZeNkQNKnJxH9SbfUlc2wveSdUJ5eGdZxh7O1V9h4GMe865/kvi3PcXoIeimQIFilF+0JTEYBySVDO7DGNwT7mzh/H97+Mx/yd3nHiDfT/w/0N9Vx57sFkJZ2xiDL6gJQdeUZ0TTe6A3pmksiDQ/g4PevY X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04c3f474-959f-4b72-3d35-08d929f4cbfe X-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 20:42:42.1797 (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: rZR4kzuV8qpdKT3pSKRDm/H15EbHJnA6A94JyNYn6DhklRCIF85InuurilsGVB/X3/XdKK3FbSU3Ukdd961hWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4495 Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="Psx/gBOb"; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf18.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.92.42 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com X-Rspamd-Server: rspam02 X-Stat-Signature: cwmja7yxwieox4d8epwm85a6sde36cc9 X-Rspamd-Queue-Id: CB71620021DB X-HE-Tag: 1623098575-260712 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 Mon Jun 7 20:42:23 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: 12304749 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 161B3C47082 for ; Mon, 7 Jun 2021 21:17:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AF4386109F for ; Mon, 7 Jun 2021 21:17:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF4386109F 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 388516B006C; Mon, 7 Jun 2021 17:17:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 35E946B006E; Mon, 7 Jun 2021 17:17:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D98D6B0070; Mon, 7 Jun 2021 17:17:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0096.hostedemail.com [216.40.44.96]) by kanga.kvack.org (Postfix) with ESMTP id DF7C16B006C for ; Mon, 7 Jun 2021 17:17:24 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 74E6882F7AA4 for ; Mon, 7 Jun 2021 21:17:24 +0000 (UTC) X-FDA: 78228188808.08.3570530 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2076.outbound.protection.outlook.com [40.107.92.76]) by imf03.hostedemail.com (Postfix) with ESMTP id A1F42C0237D3 for ; Mon, 7 Jun 2021 21:17:19 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AeDSgs4d8xeR8oC2Pjwo4w3P8sDiR1dddJmpCNVdC+UEth+LkAfCbrOPEDwEJDYV8iFidqJtpfAoDifRlkZaWszpRqSw34cUFSDRdk8LIcx+XAngROZEPWq9ijv7lFhFbhi8fJZAMRByexvIqiF5F5iT/szpIC+/vOtEq0hQVVe7OgvGRfe1neUjN8cZbUkgZ3e48p6GPrIJ+AofXlYj/kGKiwIlySC9Q6fFOxtHMf4Lc7m84t/DDtLifFjjwTLQQ7wbmRIYQJDoN0Nz84zEQMAQdt0L4HpQQXj9lAl+hoLYOxky0HIm/YYTXZxnBVgKLhmFx9TW0nc/5hqLx2JpvA== 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=WyqQUR/0z3117Dfdu2vE8hNMHMcE0VKhMUkeq7wZ/wqsazKVu2KpiaNiPDHX6SxlyCP4zXWzR3l+Y9ZjOEVu38BMeCQfurdhPrrI4vOrLtKIppmZbWW9fVLQQg1RA60sKc/FfPr+fG0L4/7g/IxwIyvqGvg/bv571xnseG2XkJcVZWwTibmDV/9djfXRSIOU3lMk1hJ6XW4qdIJ8bT88g3N2MNra9qHp8v7ph7QemD7fYyoYzRmwbQBIJhxU+RGW1p5X61DjEUahul1LVx5IiPSruOSIZqE1rl2+Me83e2VyxSHZipbNkjNSipGdfBLep7gbLOND7Y69jU3H4LaClw== 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=1pt/0hl3q1cMQJ39VrxJjcav3Ss2w/YkYDr2a1j8isNNlpRQrfZKUT0UY8SPEhYVAMCZ5pOCnGW9pG9PtEnY8FWuAm66OglQPIXfhXs77VfsUSlWatUePKlJaE6jwuwUcuqqKg/S9X7kSIKVs5TzXBZxivG4ZCq8G5fm/y+LH2Q= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SA0PR12MB4495.namprd12.prod.outlook.com (2603:10b6:806:70::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Mon, 7 Jun 2021 20:42:43 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4%5]) with mapi id 15.20.4195.030; Mon, 7 Jun 2021 20:42:43 +0000 From: Alex Sierra To: akpm@linux-foundation.org, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jgg@nvidia.com, jglisse@redhat.com Subject: [RFC PATCH v2 5/8] drm/amdkfd: generic type as sys mem on migration to ram Date: Mon, 7 Jun 2021 15:42:23 -0500 Message-Id: <20210607204226.7743-6-alex.sierra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210607204226.7743-1-alex.sierra@amd.com> References: <20210607204226.7743-1-alex.sierra@amd.com> X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) To SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from alex-MS-7B09.amd.com (165.204.78.1) by SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 20:42:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f6059f52-52f3-43c1-7eb3-08d929f4cc69 X-MS-TrafficTypeDiagnostic: SA0PR12MB4495: 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: 22FQzStFSuFaIEia+6+GDVqWwzPg0Ve6t6NJ6/fLVW2TQ6PtnRTuBkMgU6TCrM9kapimosJZjuiw9VJv6mYAFMEqq3F6Lq2teWAmHtqNGaABjO3NVpNdLRi6BNZMhvC6x3/en1J1Ioz/+meR9UDNIyKhuEi7ffez3TIsUVqYO73xOD8U/pSrMtUQYN/uo3nbn8t2steteV/UT1scQoayRoOqnxG1ic7CSs/GpaPLSjEFZfsHNq2tIpUl669I6HZocyZuA9jFu62TZe/GTILSf36pfqQIs5AuUjnzRADBi6ZILXbPExhMC0v84ss+ctF0V1xGALzfTn7680mAyPndT71MZ6WvsRG4+EyfkLEMUFYJ1FIZfUZDG7DjhmOHtwnr7ev3bskxVhjgZZwxMKx6V8T4SHi2IqP2WKyp2lCnDvvXVPEmjWfn6SW04MA6dDQ8GiqSHtT/Bv5W+wnEsqt6+lgg9zTaplNxsD00bp3p76SA4eQuytWfyhydwH4407FQ2MIlakH7RErps89CaIairCuUB/Z05VrUCHF/WyAybLm0hwRKvVmQhA4PTMJQpxxnde/OmLVDLFRqOZIlaC3Eo+JcncMSw7xB98IQlbmAx75siS1pUYtck7daFTaVAKzIbWTIPYiMAEaOviIdpMPesoSwC9Nc7xrciiIySgpT1OfWdL9GVYFBoSxDW2Ad5gAg X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR12MB4430.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(136003)(346002)(366004)(39860400002)(396003)(956004)(2616005)(6666004)(38100700002)(316002)(26005)(5660300002)(1076003)(2906002)(6486002)(66556008)(66476007)(186003)(4326008)(16526019)(66946007)(44832011)(52116002)(7696005)(478600001)(83380400001)(36756003)(8676002)(38350700002)(86362001)(8936002)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: FDXbGk4mZOWcfXLHKwrYBvVBaNoLpGVVhepjYv+6WEAmy0dvwRfS/ijp4xyh505hx4DX/3V72casCVW5AtD8U0nGhqAoWPS2DHHaqqcBYlbva6NSCnnYYLulvyndLqpH7IomDOB6rXaw8FMC2NutJTWn9u2nyJZ/X+kuQ2cH/mLkP/eS/t9CpDbQ9Ad3EszO0TavuoSzDB+pFVV3/d75PQRvDxbetuBVGuUJhyvIRSUDfheDATdDPgMqQ6n1ymfZ0CylxJNaZOcqdKSYMFlDj0Dv/tay0B7QMJn0I5KV93Jo9CGtTcZq8ROueGkVzuM6pGmiXxk759SrhqzIerH5Pm+MxnN8zVxajnn/Cg1OVxi/qxFIx+/NrRUTMDVGm2ejtJB7ByrozvSUXbSQQVqaqT0879JB8Rc3MfamZSsgC5R7oYUQFT1lEEovWTRoQBjzDi1XOyxz4EyjxYVULVCeuSL+16nAjIm9WOQ3n4FYU2P9xRCRoYruxN0PAxCjfGw1LZgHX93vsgkE0NFuv50mo/iLF4B3O+pjcy396MIlZ9WKEcTENmK0Yrotx29DknDI03n79BlbTeYYqhJaC7Jr249ULkuXJycC3IiurRGSW0ABBdkqbCr/rJESE7Zc555NZ/qea1YAbczEqDqU4/a6Ob6WmRIcnd//jorkvZPEcCXJm6H/HdvHqR7AXQOMCeqCfOuKcWRzIj9b5IMI3FKlXw3+mbCfhYGylsINaPCd2xL6+E/mEMMBlhEIIx1i8lVE8RhEVR9zeBQPGlfrPqJ9C4wk0XfrZo1KuBLWS8cqMMP9LQsGQVkJV/VfPQUFFMvx/N/Tw6WtOqzRsxzL/dOovpLYPSQ5yiOAG9H+xnK30/OEzE8+QLWgMpR5tDnu2o0w2hk3LpMo/x7IWm2XrnAzYKwmPN/KmpVPRu3Upg8tQh+vPcLPiDNUX/rlgi/TX3q2UCQhDHKJFMghArkos0KCFzmdh59VwyQhFxQPoe+SA5EPn3ICo3u4/uQOaaN84+9/4TumYsLj/3I3Tf1iRIY7BC7Blj+VZFQHPM1ZlIj85pRKozKd+HB71/AUieUublUK9dV4xURWOjNcm0DtdO4vZNwgtLnO2ofeq46uWKBKaC1heJOkgblylGr5rCUKM5Mabd+nBeSl9WDMECyrzU30+BDlx7OI3ZBflKB3QbQc3tim7c5rbVjmqNtvcXWHJvzkrAc+q2h5d8Ha45NXtrFlxVI7ZO7tSl75fNRi5pl4jDLYiP0wNxbWAHyRhPtAgpmhDqsQaI7UprD6uKDaik+JI4mAc2eWHJDLKSjrMBkTEWgjIlrX0Hpmp/CCE736BUMT X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6059f52-52f3-43c1-7eb3-08d929f4cc69 X-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 20:42:42.8925 (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: VceJZ8dd0nhAlTNr9mBR3Q7KIh60XHFZM41cNqcsMlVEJRphVOvdEhmZdHvO68/IQQHxbqMbyvToRCQgJC3wgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4495 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="1pt/0hl3"; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf03.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.92.76 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com X-Stat-Signature: tkizw5uet74tiqwsn5e83s16a3t1g939 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A1F42C0237D3 X-HE-Tag: 1623100639-120428 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 Mon Jun 7 20:42:24 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: 12304743 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 C8B74C48BCD for ; Mon, 7 Jun 2021 20:58:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6666C6100B for ; Mon, 7 Jun 2021 20:58:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6666C6100B 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 090246B006C; Mon, 7 Jun 2021 16:58:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 067596B0071; Mon, 7 Jun 2021 16:58:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E23746B0072; Mon, 7 Jun 2021 16:58:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0113.hostedemail.com [216.40.44.113]) by kanga.kvack.org (Postfix) with ESMTP id B3E2A6B006C for ; Mon, 7 Jun 2021 16:58:51 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 5A474180AD802 for ; Mon, 7 Jun 2021 20:58:51 +0000 (UTC) X-FDA: 78228142062.14.78CAC6D Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2077.outbound.protection.outlook.com [40.107.94.77]) by imf05.hostedemail.com (Postfix) with ESMTP id AA778E000838 for ; Mon, 7 Jun 2021 20:58:41 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hs8tsUdwCq2DUDTKbV3qHLz1o5I1Ezfs3KmD/xzfyi0U5fcM2EQH1sRy1HXXT0qcJJZAQS21CULSI7yGrOokSn6XFwM4P0UJaOZJbxHjQaW0v+eeyZLb8jRJHea97JILAMEWUObx3hjpcD197oFO3z7Le9aAyqbC2cVNtxFNyslEgkdiFoFxo720eoXr6tkbo2J4nDbwNepXA7t7ofHGIU9l5fQzw+OvH72HCghYwCcuzvKziwycuR9JjuCyHnPiZhNBUhyXQnaX/ZhRWZhq17Av5kJX4NG6bzVq2HPEnHVoQ1BdbQBKsQQShDbi52wqt8UPkaodeUnmNuXm0DFoRg== 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=BmK3WnsBx01C5PGjvI8BtYTEJJwiuaNStDmUhc0Wvmoe5Qe+vkWPw+Rwq1nWG9VEcsAWoXIE0xzBu8nizcyzB3OcKxs4msXosj9TzbK0Wqq2Utnkl+JwA1Zm8F/LENirn9owWXopl+s1Ci04oWUTedVAowCLoz37MUEX9kGqac73qRbaI4rZt8ztugN2YyZOjFWDqLdudRh7bo8dLvoNd8q9Q96ovC148lNd7RcOOqCDDHoVnCo7OtsusdFMk8FLwBei5ZHlwmfCC6JngyyFsb/5sD3GdHVOLRFaBhBijeEMWJxphAKMHPnKF2V4q4rZlIXDTGcu5it4/8kvWo5BpQ== 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=qw/TfNye3OxbcwvnTDPodg+FYTPG/oMKJsqFBh1XaKZF7Tm6axPqLSPuH5CewglpTT39+PwVyi4UTK2w8PZmIw7zuroWeB7dVFv69NFEWJAL1eqaSNb5UIB/ZeTW4IsvKOgJVR9ny2cZ1q66gGyxn9kdXlafBdu+HhnM1RNKrmU= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SA0PR12MB4495.namprd12.prod.outlook.com (2603:10b6:806:70::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Mon, 7 Jun 2021 20:42:43 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4%5]) with mapi id 15.20.4195.030; Mon, 7 Jun 2021 20:42:43 +0000 From: Alex Sierra To: akpm@linux-foundation.org, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jgg@nvidia.com, jglisse@redhat.com Subject: [RFC PATCH v2 6/8] include/linux/mm.h: helpers to check zone device generic type Date: Mon, 7 Jun 2021 15:42:24 -0500 Message-Id: <20210607204226.7743-7-alex.sierra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210607204226.7743-1-alex.sierra@amd.com> References: <20210607204226.7743-1-alex.sierra@amd.com> X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) To SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from alex-MS-7B09.amd.com (165.204.78.1) by SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 20:42:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bb5ea137-028a-483b-dd36-08d929f4ccd1 X-MS-TrafficTypeDiagnostic: SA0PR12MB4495: 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: 0301Scu4T6QGZeANeVnaTlREaZohn7HtvaTwIhsQ9HuQbi71sOZK/DBaOgQJExIlgJVCHhWMKRqxOKPfj1lP+w1fkSBUYVEe+yMZIctFm+4iTgW3ZhVhDWj4iZa0ZqSBLN6Qbt8WkSOpawe3gFnuZTLSzVL+/BB6rzirufbl6dqrf8guXbVt6eRuDKvj9yyEspwb1aWA2LoZuOGBfukzLkoMBNP90lif/iSZMZKZ0M9pxmREeAxKmo60ToCn70Bxn3qLA6Bs9iwKoIaGKRO7Ti5gx1Z2Qt/HtQw3aiU35xORMKg/GTBZItJTOOzQSUSqGefbefXRaSdNrnDG08263ZcAWZaLtN2L5n9h6TNBrNQypaUxKzOrMytM27Ybkjz5jiQnqVQiZiTBpkJIqNFfGW/6QbfqUGiXSEaI5lgx8Y/5wv9SpeUk9JxJacWNHZJnFNRkm663Vuew6BFvBnl2TvkMBWxWaBmBYMHdVYecUahI0i5n4SGQ/77dxoPIeP68qFDx9C67irvVdaTSwvUGLYIbHOtZKIJEKcb4Zy5EuetFdoGyN2UsCL6ngEHvT7rPsBOAvGJZQQ10HfTuULHiHCcxi49SLyocgaMZJaHHG6ynuHd26lFWnkCluEdEkvewwoK7/wKyt7WSka9sj94GKLz7h4cu1J2UZNHPwKx30u8J7wL9ikmvl91n5nznY70x X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR12MB4430.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(136003)(346002)(366004)(39860400002)(396003)(956004)(2616005)(4744005)(6666004)(38100700002)(316002)(26005)(5660300002)(1076003)(2906002)(6486002)(66556008)(66476007)(186003)(4326008)(16526019)(66946007)(44832011)(52116002)(7696005)(478600001)(36756003)(8676002)(38350700002)(86362001)(8936002)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: y7tPIf8D2KCUAHgm2yzF92Hf7oEACHcLP+GBAsGKbIH/E3sSBAG1MaW9zLMpa27deE4H9OzeWJL2wUd+p0fkITuVpRPDYZnk0b9Sh/WFaKIPHP9H+6GIZx6mlP6SMR2Pz++ssolinAiBpL2ewrfSVibQNPTHVUlaUQWcxxicsByYxiTTmmyo2uXaFWVOd11WAUvStmrRqbgLncEwXJF5v7ssd6Bsn1Itp58o0goMx6qVEkysAiLpCwveOcUhbq+gEsJETP2dnnUOB8QDEeDqzkE53i4qfBKGJP955Dl93TLh+77/uTHgylvW5slXFYXvqRHC/w/TxWx4k5kuj5Mh/7Vt1lSfpP0A2aK4JZzDG5yW8Ur/dD9pshhpf4wsaiPKq1f9NDzKBF8tL/3aX+79ALAIlX5V5bRTaY7a1e9ORNzXHbCn1Um+BVBV54vb5I+WfuOiYYeTPzaXIjtG5uE9wZNWSkJoAErk0kmjgM8eAYyP6m57iVvWcH7k2TRfSHvFsEmdLQqHvB1iBph5XYtx6DqmggnL5dcRRX0gHmR2lGiRTs490Sm9CnRJ13U1m/MfGzt9stnj5Id5xVUa4DOBwVKdF3LjBar84yuLrluG5shiOAHyhuwFoyXELBoLAkm6Uk++QjOIbpWHbqoO3433uAB3Jj2SYxsmzeJyqmOPPUHtGOW6ZOAYHU2XxADFBH8CU7AlEO8r7z1lmhpFtpnpRL4BbfHsqnmVpKlMqgOMB98hj6MUT9rhxovUOlOobaXoF7VYn2gqyJw2xv+i2V4QVU4FLXV/I1wtNttzfZRmuXw9Kl340n/q4SLZyMuBfSN0VkkBlKNpBED1o//JWeoK6DFVcmmh1/V3mHf4eQXmJOaDXoAZjL/bDe6blkJPuDut62tjqZJssZv6thqvRxloND55LCK9Te6zbvrOL+hZysSEhyzAofOOxd1FlZJvnZUlsZ/YH7vXQMHH+smJlZkhgfLckCBqjH7amnQZ8pzPaw0RiihLCQtfjHBbES2Xqi6xdgrSZ9nO5vPSVySNXAaTEFZpme5+hhQmzSEYW78RUeFF8f8n+/4i5UFup5qtLE3+UadAbn3P84oHSVNsoClSrp3JtR1aHVDabYqhMqvroc5eeMqHX35FI0oXzzGWLifJaomw3qHwxnxEq/7mfQptvJO3jjYr1yD7op8AtrrUJ29d3J+WlCy/VFikk2W65YfYfuMLxEkVsOH7080J1ImUhj6NcG6haEMZnCyK0UFyApb8I/msRM7y0vMGqxOy7g1yvZRmK+Rcpg1KZ57l7DQLpW/PHUnTzymcIEnjj7KlUMT4r8hc3lKOxsjF++4DKlku X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb5ea137-028a-483b-dd36-08d929f4ccd1 X-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 20:42:43.5825 (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: jTsbg1DRDakzjUoltl07w7kGltAvRtMHCC9Y5EIV0FwN17lueP/Yr+iDs9B7ViOQsUBSCSMWXkOHAoOIGQ8GBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4495 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: AA778E000838 X-Stat-Signature: ceh4i9b6um733ry4iqpsjpryx5pons1j Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="qw/TfNye"; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf05.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.94.77 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com X-HE-Tag: 1623099521-62659 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000090, 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 Mon Jun 7 20:42:25 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: 12304745 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 1E35AC47082 for ; Mon, 7 Jun 2021 20:59:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C4E5D610E7 for ; Mon, 7 Jun 2021 20:59:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4E5D610E7 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 634E56B006E; Mon, 7 Jun 2021 16:59:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E4936B0071; Mon, 7 Jun 2021 16:59:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 437E76B0072; Mon, 7 Jun 2021 16:59:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0080.hostedemail.com [216.40.44.80]) by kanga.kvack.org (Postfix) with ESMTP id 0FC436B006E for ; Mon, 7 Jun 2021 16:59:11 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 976AD19460 for ; Mon, 7 Jun 2021 20:59:10 +0000 (UTC) X-FDA: 78228142860.34.B9DB3C6 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2073.outbound.protection.outlook.com [40.107.94.73]) by imf30.hostedemail.com (Postfix) with ESMTP id ECC72E00098C for ; Mon, 7 Jun 2021 20:58:58 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GyPK6DEdIRwPbYQ3d00NCjGkFGBexRXZqDO6wDWK6IO6dJFxPcrbQao0CYSMG+wNszBANTkqgKdjFDnB7eCwPh28IgsWTNnsPul8OPih1Nyce4xqDpavkCA9ugqvyDI5qp4zwOdTS27C6MHQSxst8GCRDIaRmAkOgnI3bXCbyigg5BtgKf0/c5vN83fTYwAcHwc1CdoRLvjs/AWEgcyIb8cPa3TnDwaISO2NwTYHMsGwcRY47yslxv9S3Es6dx806RQA/bLOYrWWEBfUDtZP2AlvKmIBphugzGfr7M6b6FNeBqn8uYzfbCfdPfMjxwokw++CE9GJlN/T9rUlEX7pXw== 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=LIOzptCYCVGGJAqYNFf5vQGlUcioze/Jgyf3MGjBVt1e063SardFEUwTQTF1rn9HJmdk7Pb7khLtqTAH0liP7rKBojBVzxJnpSjSRUSkD5HVylW0ZNAmY/Xj20KiEgWhwMAkyYcrfeLPAG2fsUVhRy7SEPQIhr+YyjZ16VzYKMd81xS4qZ8745YhAbhC2RYDvU0pC858az8RD1w2f2xwbiRhcQPAjGj9kqMzZ+t4vLMFC0ByqvPIUyOSni7Yvxei7lLcACGi1zVsNaamN6IvbE7dRF6zI3ocy/qVwHvUekuS+Yiy66vuq4R2V4vGyiVd54VVDRQFRY1ms3UNld+aXA== 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=u0KT9dVZ+7iY6lQ2tMKi8pVublaBpD8ts9Z/l05X8MED3UXXmpv33UeJhjc6dRhbLuwZwe3mg83OlOrDmHVrdfRnCw/yXFtNt7Kl3jAv5zxaqfXqhFerAl6BpSVXezqyl22Int6hTkTzgyhuerEzpnskIRqw9ZPkPiw64inTtmU= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SA0PR12MB4495.namprd12.prod.outlook.com (2603:10b6:806:70::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Mon, 7 Jun 2021 20:42:44 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4%5]) with mapi id 15.20.4195.030; Mon, 7 Jun 2021 20:42:44 +0000 From: Alex Sierra To: akpm@linux-foundation.org, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jgg@nvidia.com, jglisse@redhat.com Subject: [RFC PATCH v2 7/8] mm: add generic type support to migrate_vma helpers Date: Mon, 7 Jun 2021 15:42:25 -0500 Message-Id: <20210607204226.7743-8-alex.sierra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210607204226.7743-1-alex.sierra@amd.com> References: <20210607204226.7743-1-alex.sierra@amd.com> X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) To SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from alex-MS-7B09.amd.com (165.204.78.1) by SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 20:42:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9729f883-244c-4de4-019f-08d929f4cd40 X-MS-TrafficTypeDiagnostic: SA0PR12MB4495: 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: 7+F4taDjcnpxGos1jOTygB8i8JBXXCjUxCmOiva7gm2sFu2aOpT4lavmWKvyRRkAqk0qDu6TL2PO54CfMLj29BKmr9Eua2kIJhjMV2WYovBE5IB0AzfSGkcD9PIX9E5q9dawvfihQxhdNt0uGCRtfYQyUqNQT4cc/m1jS/I+dVRClY/uTihfv70K9/g6pbFUpWHZj8XfRSm/bbOUCAjMcnzd5uSGnU6FtOLR6mj5lFUvf47JtzFsMWwXombcgJXU6xO/8VGLCb9kykMKyhv7oYUmsqoD+Eg5u0zCwsSRMKYv9udEGdJ7FfeElmuk+JbO5EHGQJ/wmnb6MAiHY9vNsVyE0s/d0BWt46MkwgKVunPzZp7Y+d/HLm5nOwcfjqy1mtzC1DCqNzgrdkipsXTUJAGQR4LscOibP7JPtQz941dJN2klhK96YpiA2CEpke1yZwfl0xXm6pfGkOm1wWFo32g6RGwJZJeoy12Wg7WACuVhdzUHXo7dWCgh7oErXWq6dQR5fKBViXMFGWEkScVS3keGW/zCpYbGixfmzpDDgaQKakQSyt91nnCkFd/68ZMgkZCtMDTthTJzS9xiSrTpIkrieAyFtX5cuFmvmw0uu3hacY4PDlKkf1TAO4bbqMyl9Avu49OTCoiNQ2FdATSMKdNcaPGUO5xX0PFeI+hJaY7CUecqk9cjuMULKFa+a98l X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR12MB4430.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(136003)(346002)(366004)(39860400002)(396003)(956004)(2616005)(6666004)(38100700002)(316002)(26005)(5660300002)(1076003)(2906002)(6486002)(66556008)(66476007)(186003)(4326008)(16526019)(66946007)(44832011)(52116002)(7696005)(478600001)(83380400001)(36756003)(8676002)(38350700002)(86362001)(8936002)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ZWwl0pS1xLJYD5/4OH3cHACNY0L5uNfyMQxNoSVIQywZyn43+4RnPwfb3OY0/dbOh+sFsFxJ0AVK9SwvFtAt7wj5m0ECuy9TWMuH3cS3NBuV/fVQxIV81/uKW+EgZqKvzEB1ls7VAjV/WQ6RQRUjMo+KTV5mah1axHoJ5L36d6tQzHjuQAYNmyHOBAVzADst6RYWt+7X7GayqsuLOxapCS0gI0kHrDI1ATVg5tgbgf+GJGpUjcWAeJiogRMbI+LC0CE5jTRcyyR3IDwoW+fpSjT8Ddif/LocY/Lzot9mQyDJnFFdP2ckq3X7qZ9CSyTBaX59OwtDD2SwQE5sFJX6W/rjkeifWNfSfHP6GgjnkmCMdVzICfH5GTygEytJlYR0I9SlxkZ4ZchpmxVKLQRV1OdcxfUgT8YL+aty0oEHQeYx/XCQKQDJ8xNQgTQTh8dLViPduzEvWgbEqyEHVvp5S4dnbvF9sdSJC2azfOR5SBuYVQpP5aQB6vOa/R7TokzC/XBTSGv5XXjoC25xkCCxi0P95hUZNlWdNpFSlWE5xZFohyeN2b2n0+lV0muk/ep+NXr8xdOBxQVxYTeBHP3Gp6vrfDHhs4zlODMdiZTdr6Ogh+qzs7suQbPinEPhiJNiks7QAXUSjyRnumwngtQ1UvesbrqLL5agD2IwgBoqScPiPwk5+oHnPAP0vN2fIOfLGvsvfjOAegnkV1yqjq0Jd1NgHRbCWaLHc7fj9ystWEZsuWOkiNjtPF68FtbQls2+FH1Mi7fqP9kVgrMu/Y312SU3/wEOGgkGC67ZKNuK4tcYQluaNMTPHe1j9VYf4vONGQsOomnYnhgWtWFgmSlCh20JrX0+0XzMelhaVsvOsi8DzOBo72vpFjfNAdmFD7REQ0vRxa4mjo+tuxcc9M8mFc51wrPEOq0SLFBLNqCqqlnrIAOnIBP9p+ECULZE5br7kUsswwL1gfjxOeLCG/KgoW5QUxk/DqJe4mW4X2MT+PkM74ij7rPsdHuVGfmBuyqe7Aqa6VBjKqXoNMtsfVyslQhvmexFTIYGCklhWmUiOLbqTS/kXmtcdx2K5pZVqWUNAQJ0FQj07HTl05+OIiTl3Zml2SGYWhibKwbcndL2gtOPnRUJT/Pf2spUyHs2rwxqNUcDNht3WWdWXLNMHAYl3/g7Ev8WRHl2JTbs+q4GhVK0MAnouigj6NgBfnQukQzUXT7HQrUA9XQHJ5IXdVCqr4fA33PvaiX9rtMg7XbGdfrTWA+kvsGGV3wM02utmbdgaOm6Ffyvdm2WvS7GAkliqlkpWknUDCXG1HojfEel4lIHEHEwTZAR1Gxzc8C4vqz+ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9729f883-244c-4de4-019f-08d929f4cd40 X-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 20:42:44.2864 (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: bFFaOo99AJqY71LR22eKHRH33NXUoL9iYIlpOzI+BVMFouvAYTsPrSHZ9IvlT9LAky219ofSA/7H94bVtY324g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4495 Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=u0KT9dVZ; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf30.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.94.73 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com X-Rspamd-Server: rspam02 X-Stat-Signature: 4ae31csdgwrwbwuqkdkp3txz1c7z6pjy X-Rspamd-Queue-Id: ECC72E00098C X-HE-Tag: 1623099538-911072 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 Mon Jun 7 20:42:26 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: 12304721 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 40E03C47094 for ; Mon, 7 Jun 2021 20:44:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E37C961139 for ; Mon, 7 Jun 2021 20:44:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E37C961139 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 8684B6B006E; Mon, 7 Jun 2021 16:44:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 83ED36B0070; Mon, 7 Jun 2021 16:44:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B8C06B0071; Mon, 7 Jun 2021 16:44:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0049.hostedemail.com [216.40.44.49]) by kanga.kvack.org (Postfix) with ESMTP id 3CB616B006E for ; Mon, 7 Jun 2021 16:44:34 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id CF47A824C426 for ; Mon, 7 Jun 2021 20:44:33 +0000 (UTC) X-FDA: 78228106026.02.8A8E763 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2087.outbound.protection.outlook.com [40.107.220.87]) by imf24.hostedemail.com (Postfix) with ESMTP id 5A3A2A0049EA for ; Mon, 7 Jun 2021 20:42:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bbvudekOZoj762VXfd8U8rvr+eaS083WfrCJjoFZU+gVanDs7xZp4oAhcNJPBehegM2k3IQ0c09eqB/VdJLlqqvAf/1XnRfiPgkXTRNJ9ns1hgfCbO7rfEy99ELAg/DM3EAk5AJ5Zo00KF7VGFJ2TlSgJWQboUxD5i4fSI7lLWTwk2DM3M6H/u2mVsx5GECNEKD5TWvfeaYYo4CCykF/jbudYqEZL47rrzhYFD1bdGeLzfWvJg5QzNnist7edg0sNr3prVOJPCLyl00tfHv4YovoOyraZb/WY5ZNMqaNf9zf24Yjz2CBanTZUnOUWardubJL/MRsNe0fIEJJH7bPgg== 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=grD2EHIkLP8zn1oiO90bTVhjnl0q0tPvA4zfBosTUuQjIxJ3iylqYZWdfRn9Jk4pBqw9/j9TpwNkMONJFf12yzXw+TswwklIIUUGeErEA8iqDBA7lmrvXTlMHXOZEcqscc2zwPnk1CG6z0MAYRkAyPYoBUqXCmi3ME9+85kdQRb6wP1XmpCDv85e08NFdJpow/1SJ5N+Wg++R8eb+8IAMcKiKgmPZd0sbaJO0sUE71+USqhmKkQrgHy6BIafiORaj0EnrzkWQAO82h12XcjgOVRQyHbaSWw2WNj9IeKVb3vQzQmyXcjTTqTc086yUJfD+wVA5Z7YG4Zz/1lesygBiQ== 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=bil8kyODU73wnU7ABfd30JsZY5NPgCy+etLk+JbFlO2J14SFvk7izPKP42vmeLJB72IAwoxHdJN+Ccvwn6BnVPW6dHKPhRkV2Xo5AOEtjW9jVDuW0Qj/DnMiIJyfPWFbyko3OmQcV4fvNBzipe58zg9dwj4JvAlK9Zb24xvoGqc= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SA0PR12MB4382.namprd12.prod.outlook.com (2603:10b6:806:9a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.23; Mon, 7 Jun 2021 20:42:45 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::5ce6:fed4:e00f:27e4%5]) with mapi id 15.20.4195.030; Mon, 7 Jun 2021 20:42:45 +0000 From: Alex Sierra To: akpm@linux-foundation.org, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jgg@nvidia.com, jglisse@redhat.com Subject: [RFC PATCH v2 8/8] mm: call pgmap->ops->page_free for DEVICE_GENERIC pages Date: Mon, 7 Jun 2021 15:42:26 -0500 Message-Id: <20210607204226.7743-9-alex.sierra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210607204226.7743-1-alex.sierra@amd.com> References: <20210607204226.7743-1-alex.sierra@amd.com> X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) To SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from alex-MS-7B09.amd.com (165.204.78.1) by SN4PR0601CA0018.namprd06.prod.outlook.com (2603:10b6:803:2f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 20:42:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c0df5c0-d618-4759-b7c9-08d929f4cdab X-MS-TrafficTypeDiagnostic: SA0PR12MB4382: 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: ln/jdAEv2NcggsdMbtH/oXoU9tF8Qh72Pp04Q9pIZZHkBp8dt8yNLfGlIaJcJ2oBIvm8mCw1neYRKB0Z2CRWEsyDgldmfob7rEaZ91oOfTimR2JXwdTOGG+I8v9b9F8SKpSWSOUBqbuOFmclIoh8wwtZhLNcIkCeTN5Gw5F2N3mdh3zn5A2H3l/9vckI/pjAGZQG1cLbTm3UJtp2OC4kpBLyAqowGpjBQ3U6X9egagqzFxO3SBg36CMimSxQd608iz2jTaVKI/o5789if2pPrtkJBXsH5lg5T/bhG2YN4KaeoEhHI9WD5AuCUP7IxhgJw7AwL/+89dzMu3vaS+y2ocpmCO0RodQXZiXvkQ9qYHUuiZM39pte6nFnIVjYfE6XL40VIx2P7lWLf2RSjbz5AEt/iU1YXSQsQ2YPUhhmbSAxnhUjTbiUEXik1acstdNGbhq+yAm0PrvzjAsmwy6uQXEiDvWVtaAJMfzj5sq4bKjaeGLW52MunB+XdRq3ob5ZUnUw/aeZ0ZbsSdX9RLGSzumY3HArL26/6jalOpsjXiKvxBm95n4y7SK4YKQH+Y6kcsGLVbDp2/mPiHoaChfpvJNxqwGZ9PZPoreL4Uj7IUMbqaZ1psiYf5HABJkMpWF+gLfYBWPN0HlCazQZUWq+hKRpxf/mnsev/5n30/j2PQL3g/OramLzcIyn4ZBYetpE X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR12MB4430.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(376002)(136003)(346002)(366004)(396003)(86362001)(956004)(2616005)(2906002)(52116002)(16526019)(7696005)(4744005)(6486002)(36756003)(186003)(4326008)(478600001)(1076003)(66476007)(83380400001)(66946007)(8936002)(8676002)(26005)(316002)(5660300002)(6666004)(38350700002)(38100700002)(44832011)(66556008)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: r89GUDAkMeol12U7Id+Ua7o0DSNrJMMIjYmg3GFWVpme8+stbXNsk41vKwQE88SRzfsAZMENOiBeyQdLKWkeD3cvTKRQLktFnLPTAnOWARuHuywMFIALrRoJO9MsMv7YfrLsjAVDKDi3VO9IDbqQAq+02fMxWpVfowhqC8RWM2qQn4Lb+KqJQPE0p8u4h+Swq4NBmG+Wrp7jcxHDL5mC0Lj+wXWPGbi3KTsYpvo2nte2v7tpkJI+dWCf4Vsa+7YMPxqm9ENT9peDg11TVHbCJLjUHXYUonqmlcOkt7fz5Qudxex1rVDxLhiNePKl/m620Jk5wKc7rDli+xZq9KqqPOITFvajQPJJeBrmeacDXFTJiBcMLOiE+fbML7JozPK7Ei8tsQvn2639JzWyx4YPTo4HI+KWTTShMfYl3S7gC8jSGCQxu4WFbbHWYk3H1Qg144HJzvzkTmUV/9CLJbEF8Kgd+w52RXFDmSFXkE+xV5bh3iOkt201la7jLagoN1ZdM+YPJhleGYxMwQ+H24I06OsYUWZpxKh/zM7jwvT3auZiriU/S2ClVAUvVXu927OC44jpvBFMU3i3fLLwH7voUn8+KJmogpgPZDuLvhPx3x0o8tDaFFx70BT3WZ8Ei1mz5IICa9A7NPIZoOfnDJcICCVI388hhHcvgeZgl/fdGRenJgAMc9ksm6WdemtzTvxdDTs6vUQzUIEj+eCQhfhfKY6itKmd/k9f2FKiGhSssE9ORVo9BOisp+FofYDU4d+QH9tHFxq//gtobmuKVrre8V5aFYNzi0k3maau++l1JnqCGWA2ZRymmUusF1GzR025nbdDkP4ANtrQc5iekfKYb6Is17wbzCnT/NoylgCkzOi5im2YLVAld8iI+yhdoWQGptV49vEuIGavzTg6Bo/41vMmj2Wn8YgP4n8ofDa8clNlJDWqNHL8EJC5cbHv1Y0CFN/jZXdGWE87//Js/vUAKbbJp/ZEf8th7D6XXrMu0dkV0P+0HgN5XllNyTCWf0OKsrFw5a86ldnpYy/VAtuiK2ObxHYewogSS6sAVxirJ5P/Hyis1N3DpuT66dHRaOBcUBNnF2KXD5hs5Xu/KQZdFuQJI3w7pPWPN/UBSeOOd8sK6VP/v1uJ0GM9/purot0OJ8OqCWr/dz3cjpWcZuuqUYki0B6u3AUU7MC4ueOv7fwiCPoC5DvPonUJkJnvb1EbCqC8N/eCQkSTY7VAfq1iCOSn4L1pUqgT0W/ET6rn2LbjUY2alse42VqFU4EZMamAzccQ5ifvMOdQFpfjvfPwZA4Uv2sxH6n5ZV3bZHipgqzcecnF7AAHBv6Z4TpwTQK2 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c0df5c0-d618-4759-b7c9-08d929f4cdab X-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 20:42:45.0102 (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: lYEX2bM6MZo5nS0ruBW3ZtEnlNW6gtKbsXpbng8cMwKyczRcQj/NAeS0qFDbWTmWb/R7n+6zN6U8UPYbiu57Tg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4382 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 5A3A2A0049EA X-Stat-Signature: skgmoqedpkya9f6dd66igp78pjpnm9on Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=bil8kyOD; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf24.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.220.87 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com X-HE-Tag: 1623098565-211954 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;