From patchwork Sat Jul 17 19:21:29 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: 12383837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 928CAC6379B for ; Sat, 17 Jul 2021 19:22:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2EDFD61176 for ; Sat, 17 Jul 2021 19:22:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2EDFD61176 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 F1C888D00FB; Sat, 17 Jul 2021 15:22:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF4568D00F5; Sat, 17 Jul 2021 15:22:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D6F988D00FB; Sat, 17 Jul 2021 15:22:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id A8F7B8D00F5 for ; Sat, 17 Jul 2021 15:22:02 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 63A0C180AD811 for ; Sat, 17 Jul 2021 19:22:01 +0000 (UTC) X-FDA: 78373050042.36.0A297E5 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2088.outbound.protection.outlook.com [40.107.212.88]) by imf26.hostedemail.com (Postfix) with ESMTP id E5447200170B for ; Sat, 17 Jul 2021 19:22:00 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UAOkMWIGiUT9+bovwCrFqBKuQdso/xYFu7FdAj7Bd87Tzj1ObVwLdm1Y0uPK5pF6nBMDNBUuwQfWAp7qTah9zlPyv2+ZoSu0lpWqW6HFrP2o/17HhNBTqmxYKnGX2rEAtRImvog+pjwH1KMyJrhVXwC1iJbPxcrdd2bH2O5ZKGSZC3mG3ygRyavpbHeNqrNZA0lyQtpiH2feUlS+BrLUTs7V2hcMhTBEa/1Qq5xEKYVKC4BtCYwmC0wofpeQKVnpBW8BnEHyVx3dk35AIRICF57tMw6jJSEl8eJAZ0LSgihHmkXl2DyOBFuEOY1MCQ53Z9H1GavXv23XFuvaZZxlYA== 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=Y4+r/IEg4rDKbRnDMnysY04/FdE2VvCumV6SQrZ8RLQ=; b=Y5Txbu9MIESUJRApkWmBO9Siai0fotCgMUF8AQoMbsOxHM2K6iVQpp1nRFeQlFLVc/5mpvCG84QOqQhPIENapY2+0d4hFHJfg05wAUw5HaHBYwiDTD1N2R6ITmr7DoO/lBKaH5YF74fpqRPYD184yieeGtelse00UUFJPk915QrBnFmS46Jg0mPmWKZHc+jpFTmTmCR2NUjCRQURN3OGxh1NY9A63B1o4VEY6b3fpQSb0gGjFa7uqlcO4LhzB1ii/rXfUEmYwZ9rnhI9O3gGxksDpZNBYowEWrZa1UjMO8DFp5V+qdTLIoHLd3RYhgvEUQxHKV4c4UxK8D/3Kk9pkA== 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=Y4+r/IEg4rDKbRnDMnysY04/FdE2VvCumV6SQrZ8RLQ=; b=E4K9dcbicy333R/yJnq7OE4LDM5EeBgHbl90Ev+TMZK1CkbrIOIOtetdhDCMAfBKUvUadH4cL76nusjBIYYIdCQmwuWosKoI0EMHKtJ/B3c78JAvkrfFHBBWqR2YsMQBmcy/++PcIV8IHTO/7vI85kg/pPEC4lKK7PIn1bLxStU= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SN6PR12MB4670.namprd12.prod.outlook.com (2603:10b6:805:11::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.22; Sat, 17 Jul 2021 19:21:56 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::d0d3:a97e:6b7f:ab39]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::d0d3:a97e:6b7f:ab39%7]) with mapi id 15.20.4331.029; Sat, 17 Jul 2021 19:21:56 +0000 From: Alex Sierra To: akpm@linux-foundation.org, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jgg@nvidia.com, jglisse@redhat.com Subject: [PATCH v4 07/13] mm: add generic type support to migrate_vma helpers Date: Sat, 17 Jul 2021 14:21:29 -0500 Message-Id: <20210717192135.9030-8-alex.sierra@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210717192135.9030-1-alex.sierra@amd.com> References: <20210717192135.9030-1-alex.sierra@amd.com> X-ClientProxiedBy: SN4PR0201CA0067.namprd02.prod.outlook.com (2603:10b6:803:20::29) To SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from alex-MS-7B09.amd.com (165.204.78.1) by SN4PR0201CA0067.namprd02.prod.outlook.com (2603:10b6:803:20::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22 via Frontend Transport; Sat, 17 Jul 2021 19:21:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d137e190-98b3-465b-ba1c-08d9495820c4 X-MS-TrafficTypeDiagnostic: SN6PR12MB4670: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YAn2JIMEjrfipjm4vfO9mBeSy6bG9/qOmvtqPBmAocevSDw+quy+ShOsc1Bj4G/NuEFwCfR5EVrOUINfV4eocv1sFiOAFvOitqGScIqIOxzaFZcqOVhRx19hzh/ANjuEpQn7b63EVPGyrX68LRHuTFukSpKEKTHIkyPKO8PAn22hrei8iC3xBfz8skbzgcj4a1vMQuvFGes9NkLFUz6d1TVKZEofYKgtvjRvQz22hc20LsSct1jpVyAm6EZq2wn/qtF/w/Jtrsld5Z0qVCzTl87O4wEpLUJuGGqb0f0xVscBVq4YEAyd95ciAyfqxTL4TsZNA/7O+HX3s8cdDx3Yvx/Q8Xq/LbndAsYTOZaD6vs8N7VXJqbicRtbgur8gz3Bmhn7JrIpLVUlo1teRHuJ+Ap4aIkVctym6/MyULYZXcSRNMY5ui9n5ciO8OCwtT32rJItqlTuFsMd6KUMsKrXO9bEpjHj5UACmSJmu9t6KXCdjmdL7AbIkNuDBp/Pb4B3qPLl7M0FhzHZZYo6XoPjxZyKSYV6LJO/IYOHZBcArde4Tsifaf1HzoEQZOcw9QDzTu2Hc95BOY3bcM6eNbL7PVcZH4Mnh5F7lONEDpanXYngs4HMpQJYW3/pFeSSec9k08EQK3dZZiAur4R69IeHpVZGyT9te4qQ+cv5lkvL1Mbcs2NkpzVmcmJO8SenhCFZoDB3NWAn8DEgJXZ5YN+vpSU0JDqxXRi69r2Uwgi+8XM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR12MB4430.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(52116002)(2616005)(26005)(5660300002)(2906002)(7696005)(7416002)(1076003)(4326008)(6486002)(6666004)(186003)(8676002)(956004)(66946007)(86362001)(316002)(36756003)(44832011)(8936002)(38350700002)(38100700002)(66476007)(83380400001)(508600001)(66556008)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: t380QsiiYA/318jCZ6HqbVL6eK3K7K/v2C5S3eCMdXmq4bnJY4S3Akp7UrHmuPbartPtep0EETxHTZwaP/nAn1Za/5/nt6QAHcN/GoZ3TZ7KtV4xvjRIahhYsQpwSw1ksiaDZx5NLcJKEU8Gttl+kQBKXfvt8VAhmwplqNqXbKx/XinYwFix5e0a54OQxahmBh78/G9HggcoADqHekAEojCXQrjaJCQzTHVAj/FZ5rBBePksMIVP6JBBWR0xTyqcAW63fNn7KE3JDAwzGM8ubxnTpT5zlLszJB9jcd5paO+syzijHcvUxKa81I/+yqoVGpY3uYc6FDOmRL3jpOxkhce2Lah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-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2021 19:21:50.7161 (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: JzlQhrrYA0aG+FokRuRQBTuOzlTOjlTKwQ0rQ/A+Mt4CwlRj6ek48ZlcDqbuR9vamHwg6Kr2Kja7kXaXnHbnmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4670 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: E5447200170B X-Stat-Signature: zkackfbu6fwwg56wn361xrwutiw4cmk9 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=E4K9dcbi; spf=pass (imf26.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.212.88 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com X-HE-Tag: 1626549720-590818 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 | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 8c2430d3e77b..7bac06ae831e 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 */ @@ -2891,7 +2891,7 @@ EXPORT_SYMBOL(migrate_vma_setup); * handle_pte_fault() * do_anonymous_page() * to map in an anonymous zero page but the struct page will be a ZONE_DEVICE - * private page. + * private or generic page. */ static void migrate_vma_insert_page(struct migrate_vma *migrate, unsigned long addr, @@ -2956,13 +2956,11 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate, */ __SetPageUptodate(page); - if (is_zone_device_page(page)) { - if (is_device_private_page(page)) { - swp_entry_t swp_entry; + if (is_device_private_page(page)) { + swp_entry_t swp_entry; - swp_entry = make_device_private_entry(page, vma->vm_flags & VM_WRITE); - entry = swp_entry_to_pte(swp_entry); - } + swp_entry = make_device_private_entry(page, vma->vm_flags & VM_WRITE); + entry = swp_entry_to_pte(swp_entry); } else { entry = mk_pte(page, vma->vm_page_prot); if (vma->vm_flags & VM_WRITE) @@ -3064,10 +3062,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;