From patchwork Thu Aug 12 06:30:54 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: 12432583 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.5 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,URIBL_BLOCKED, 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 9CDC5C19F3F for ; Thu, 12 Aug 2021 06:31:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2A60D61058 for ; Thu, 12 Aug 2021 06:31:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2A60D61058 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 895926B007B; Thu, 12 Aug 2021 02:31:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8237E6B007D; Thu, 12 Aug 2021 02:31:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6286B8D0001; Thu, 12 Aug 2021 02:31:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0186.hostedemail.com [216.40.44.186]) by kanga.kvack.org (Postfix) with ESMTP id 380276B007D for ; Thu, 12 Aug 2021 02:31:26 -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 DD7C78249980 for ; Thu, 12 Aug 2021 06:31:25 +0000 (UTC) X-FDA: 78465456930.32.3F5654A Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2070.outbound.protection.outlook.com [40.107.223.70]) by imf17.hostedemail.com (Postfix) with ESMTP id 82BF6F006EE3 for ; Thu, 12 Aug 2021 06:31:25 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DlEsarxsxNuy5dvM+wNCfkfj7wDSLIyL4ZyOXkc5lLc+7LF8HN6QPB175CKHIuFhX0c+STlNUxkp0QFW3HLrIyYWrMieqGEBhYDMqonmoLsZ78zvbe76Kjif2tVqfh5KqmdkFdAVkpu8HuaT/WGnoaPIY59WhmooA1txcPKdbtaIw33T00YVkyzXid/i65HEin/+hSH3oxhHi3Ss2XGCFEr0bFcPUY46rOuZiaKSmAMPZKr84014uqjNuW0VOBDEO1aOcUYDwqwP8QIBKPYmjzIzMdgRcx7PJv5mxEfV5Q+SwVVMRJsOX8nd5+WkOMBicN8XClhHVdg7u7hL+Q/ecQ== 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=K1OutIEAS8xOVVCChd0gKCpPqsQQDJ/n8U783aQxAxxi+oRyeJ0LShRA1Mp5ued6MpY8oSV2Cjy+J/XOzrR2nAhVcbIvHpzqu/fjp8eEOaEgh6JBR0WFjE0oMKvlYX98UcJavlpMq7YwDD+VwvET7BXLqYqiFR/ho4akq3hvECOVaIOcn6nYMmj0nyn5MQHfiELfNy9ubx9nOkXq0Nxjy9t8xgbxaWoV3ZjDMVCMR3h8fCLM8VZ/XvR2Nnaww6w+HyK/UV8VbTjmOq4baC8QJHjoSuAmmB0ZJp7qNSgd+vJTBHN67jqfv9SYyf72zNWLYvmzjYy0d7QyyenLl8y8Mw== 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=h/vdQ/l4EE1vPMVSoTmWupQ5qCF6y9lsScPCyXLPooNTUUYuTgkeemfwf10GkUCt1E22mb59FjEyWs1GtGvxohSAvJl3DK5kjAO3tK4xzgRJajTV3vE6GLA7DTuq9CtSmIV76y9ZOrfqOEBhsP5hBcwd21iNpYTNG+oZJ35Mdlw= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SN1PR12MB2448.namprd12.prod.outlook.com (2603:10b6:802:28::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25; Thu, 12 Aug 2021 06:31:24 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::e828:5445:a5aa:94cb]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::e828:5445:a5aa:94cb%5]) with mapi id 15.20.4415.016; Thu, 12 Aug 2021 06:31:24 +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 v5 07/13] mm: add generic type support to migrate_vma helpers Date: Thu, 12 Aug 2021 01:30:54 -0500 Message-Id: <20210812063100.31997-8-alex.sierra@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210812063100.31997-1-alex.sierra@amd.com> References: <20210812063100.31997-1-alex.sierra@amd.com> X-ClientProxiedBy: SN7PR18CA0026.namprd18.prod.outlook.com (2603:10b6:806:f3::18) 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 SN7PR18CA0026.namprd18.prod.outlook.com (2603:10b6:806:f3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17 via Frontend Transport; Thu, 12 Aug 2021 06:31:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3b4c49fa-afc8-42c9-9a84-08d95d5ace64 X-MS-TrafficTypeDiagnostic: SN1PR12MB2448: 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: TCjTgwFkhtwFxo1np2Dwyuh77GLzXkoSaaAno9zYVEvZX4lDgSXVP+MsgsHCYFQK1aSojNuVw7OESsjw9r1krR4rTfUIrSbe+QoHcUkLCfv2ma05l5fdQb4bR+pEcOY6xI7h7/Q/PSA+ZW0Q1BCTVTcppVBusnlAu65GYDagaRFSp4ENxhHCJsbM09Ws3Kk0iYabTd2EODcsPNQ8RgBdwBcaxlCuZu5tUuUZYXBJsmD7RGV2T1tBSebdpJ+IabSonWccc21F9WSKWkwBKOqiOUPaCjNfSt9Y4uawAex9YB0+0hiikshf9HuHHUeXdtXUYRKG1XVqhPB9TOPj523EQB1HT1tYmZOM0BEW9OVyEXvlhZe6RUK1wPYkiMYwwn2wDpILSjWMxn30pAT1p9bfnZODM29KrY7KcCtqBmYqUIf081Ny/ZIhN3NOq8hXBQkq8lDUZs6L7dMTxsa4wcMmpaGHKFITRjgH9evN+Tzcu24r25FBejGyEyhEclXBq5qUTFZOMKa72bF3HkbG+64b3oEI8JYf6QSRSqFoWbAgbXWA/K6/XdQ+VfWlv6p/HA2DXkgHxhfFoAR9lWcUFZXhMq4kW9C79hU/vTaXNCvQ2YDucoGhKk5IaeWtYXX1BW8i9i0aJG2ONFAvsijCjWosHxsPC0c+GigpczrhLsTt4fWOsTJNi666nhNjJNnplszoGkhgwztdYOLF8qyZWld8qH5e92UdzmL7RLqpZFeJJhU= 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)(39860400002)(396003)(366004)(136003)(346002)(38350700002)(6666004)(186003)(66556008)(66946007)(2616005)(478600001)(83380400001)(38100700002)(8676002)(26005)(44832011)(2906002)(66476007)(956004)(52116002)(7416002)(1076003)(4326008)(86362001)(36756003)(6486002)(8936002)(5660300002)(316002)(7696005)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aP5FlJIEV/CG5eZsPypuqz+t+KlGHGuEmotiiIEIxnZu/PWprJ+LqT3R2HSrSy4YPnjGkAd5s5cPX3EBK24qq9DQeFjJWYR/ZOXdRwleG9rDuL0w0MkczL9ypiRLyKy+t2I+WIQ36CP6kK55EK3zEWyRAcnRWa1tn8nKRcwFDgudFEX5HCGVFCGrU+/WPx64BJJ4AUPkbNNL9jCroOUfgcoHsVJWDQWazqKaQ7T0QzcqVIKR+ds/EmBJsw6IoM36k3SbBMQD1vEmUFAOMbbC2+/4WYzIUqR/i/DDFTCTLcYcUiPdb5OzT4x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fa-afc8-42c9-9a84-08d95d5ace64 X-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2021 06:31:24.2288 (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: qBmIr68tA2ARHgJVZoNxQgaxKND5jIHjUZ/yQfKWsy+cjVtlvUKTTkaGQYtZA0h2un30RF7Ce5qOrf224XZO/Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2448 X-Rspamd-Queue-Id: 82BF6F006EE3 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="h/vdQ/l4"; spf=pass (imf17.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.223.70 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com X-Rspamd-Server: rspam01 X-Stat-Signature: p1pme8c5aaderm7patpnnser9dw3puf7 X-HE-Tag: 1628749885-585999 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, 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;