From patchwork Wed Jul 24 13:01:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13740941 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07442C3DA63 for ; Wed, 24 Jul 2024 13:03:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DA4F6B0099; Wed, 24 Jul 2024 09:03:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 98A416B009A; Wed, 24 Jul 2024 09:03:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82B486B009B; Wed, 24 Jul 2024 09:03:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 61CCF6B0099 for ; Wed, 24 Jul 2024 09:03:01 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1E90C80972 for ; Wed, 24 Jul 2024 13:03:01 +0000 (UTC) X-FDA: 82374661362.10.1FD3B10 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2054.outbound.protection.outlook.com [40.107.93.54]) by imf27.hostedemail.com (Postfix) with ESMTP id 214C24002D for ; Wed, 24 Jul 2024 13:02:57 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=s0vQVOpe; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf27.hostedemail.com: domain of ziy@nvidia.com designates 40.107.93.54 as permitted sender) smtp.mailfrom=ziy@nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721826124; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=FetlK/722fVi6ZVNeIZFKwGEKahpMrmor89WHb8Wxko=; b=QmXVeDQkjEsFyIlYba4oMcHnEjF7bLxEmIG5TFv/oJP5AYAWyVCF6RGL2K9RHybnr7AUaR RJd2paHhezCJ9CbGt/hP1OmOx71YtwONhE2UGmDpQsXY6y8GKOeGMRw9jSNDXwxQaihkpo p2pxra8bdKxTqdgS8YnFMUisy5Ma5CE= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1721826124; a=rsa-sha256; cv=pass; b=np5c/W/RQbtdomhdywGToLOO3h1lbkYeEQEI1dPRn4kxk5DY6BICLvAtTq4USrLKDPynpj ooHSCNNWEa/cbuX1soHqx6YX65gF1rJ+azOdsqlsYXQ3Mz0+fR54MnQ2kcbj4NL3b8JBBm fgDUNaMsXVhVVZhkL+bqVEOEgxPwxms= ARC-Authentication-Results: i=2; imf27.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=s0vQVOpe; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf27.hostedemail.com: domain of ziy@nvidia.com designates 40.107.93.54 as permitted sender) smtp.mailfrom=ziy@nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oTXQPqJNxFxP6o17/mkav4CxxEShfcrWQuM9qYsOm6BRvtQKC26A64WhWXRQ05/Cisnhalb4r9h/8g6KXGbZVnyY3c4IzpFLVTebne0tThpBP5HafW6v2K1CIJOlOBY41ihYt5HXjMjOa4gHRxUt/wj85A5V55s2dgZ+jPMcG3YRa+UBMRJu6JrMW2D1ff/M5+teKIGYDXJ2M/zgNrrco0EZa5ypnfTH3RMCSuyxXhpcYgJFG0f3bdkIVqmst3afh6mV75jSAvwwswCgOSmAix6K5Jak0poEQdq2/jEQuqyXCls9GHPxE+3UEbMewM/CRCgNJBj6MYZzntsJb7kodQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FetlK/722fVi6ZVNeIZFKwGEKahpMrmor89WHb8Wxko=; b=POdlAqhXttN4PRJRPmH5IxnikKN4/itPBOkPYZB+6f/rQp7j2od+bTXwxqDp8XAoggdbMgcAT4vvwu+yuh5i4LI8Eg8I30iOoHOR5YOsYtnK8FzxeSMbQywSVthT+Lud41f6RF/7HhQtxOqW7jUESzwc/eIkMwgAvO/5Mn+Qvua+W//e+YAlOxAR/+0g2Jk+OZsnDl2YDTrJv4bBDFqVkO5gfHyO43Tg+JccoY+RTUWBuctv5d7HtiM5AdeU5vUrgvwTIBRT7MhErzM2Q3fIzsWIfnMHjquHte/BtUA5b+3od9/v3ElJdZR1GLGDFQpfq0MI0JoY6MZHH15EP7z8vQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FetlK/722fVi6ZVNeIZFKwGEKahpMrmor89WHb8Wxko=; b=s0vQVOpedj38HyNtjrjdCuIwlXmgFVUn+DRELWIoHNSIVmF4a7CLnAKq0ooPoPMZFs9ZdUe4UShITheGTsx4Q7ED4FbO/XpJGbNbmhxY3ZZ/z6YynrUAdUkbz77rvjY7kzEo9M0qdgkPkL9/dbVEhc5Diy3P4xz44VIJeYRPmpDTWciBZYF9vYj6s69WOqQxk0DlIc+Atwc29dQakDrXnaCUggslUi4rzjWpFJRKJHyVqWQi3NFcbHMaA+47+fLg5VffYq4eT3QFKEm/pTW1bKJ3MC5EjjV7cqs4mSHlE4oTkQ3LtQ8/y+VIChHnQ7sBDk6Qs18VjrYW4eMvuaByzg== Received: from DS7PR12MB5744.namprd12.prod.outlook.com (2603:10b6:8:73::18) by SJ0PR12MB6709.namprd12.prod.outlook.com (2603:10b6:a03:44a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.28; Wed, 24 Jul 2024 13:01:22 +0000 Received: from DS7PR12MB5744.namprd12.prod.outlook.com ([fe80::f018:13a9:e165:6b7e]) by DS7PR12MB5744.namprd12.prod.outlook.com ([fe80::f018:13a9:e165:6b7e%4]) with mapi id 15.20.7784.017; Wed, 24 Jul 2024 13:01:22 +0000 From: Zi Yan To: Andrew Morton , linux-mm@kvack.org Cc: David Hildenbrand , "Huang, Ying" , Baolin Wang , Kefeng Wang , Lorenzo Stoakes , linux-kernel@vger.kernel.org, Zi Yan Subject: [PATCH v3 3/3] memory tiering: count PGPROMOTE_SUCCESS when mem tiering is enabled. Date: Wed, 24 Jul 2024 09:01:15 -0400 Message-ID: <20240724130115.793641-4-ziy@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240724130115.793641-1-ziy@nvidia.com> References: <20240724130115.793641-1-ziy@nvidia.com> X-ClientProxiedBy: CH0PR04CA0010.namprd04.prod.outlook.com (2603:10b6:610:76::15) To DS7PR12MB5744.namprd12.prod.outlook.com (2603:10b6:8:73::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB5744:EE_|SJ0PR12MB6709:EE_ X-MS-Office365-Filtering-Correlation-Id: 3da80656-9e10-43cc-8961-08dcabe0b79c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: MnTThk9tzg2CzTQwcX0JG8vwlbLhvLKjoRcJsBF9KM8hFvuwrWGLZ4SEiIHfQb1+2MSu1zm7rBG4lUd5d1omzx1w1P3f0RihwIXRR6si/gbh9iAB8iFImALDq1HQnl6fM+JEhz7zXCJQOgllnH6AvFq6zdIL0SP1Bs/n1IzqmTneupGbD06Woweb0fB+cBKlMHWsj7WBcoZNzaU3Huue3jWfrnVJK2Z+yHHhIVe+Cd9iE79XQ8KJeKsLEWkTv5pujwBPdMnq8sxrnjsoXQVJsGvgwLnQvuODWxWYA1ieZFnCYWnjK40g3//QqQo2GocCNZKIPrNp4+LESPPtmxKehvA3AE6GrMi453hAlilsRT1DyKrDbKhseIQ/7hQzN/6FUdkByMwXA7Z14ZzSANIIlF5IT7kG/vkmp9AZ4oVSPJ6MeJ5nO/7JTKZBQ8qWYJQ4nq657fK4HImK+bgrWKYMvV6AjeujumrjtdeHZBut6mXT5300NpT0pnsFXczWvqpb5WJmK7dejsbijRPZ8dvHmZJ02cBvEE57iJafUqFEZuEf/GgspEtv17Fv8WUvjMdzwXynpGVf71ysuT+OGpXw68eWrZ4tP8MxRqIEDIKHgLoZ7nQT1JC4bIulz1J6NFQe/w8cWNIEeuVSZtEkXRzwuHnOEA3wAsSpJxLkIn86FGoPIbUCnqyf0KwaH9p2EUXgagdhrqRdI8/Yq0to9lNluTbLxV/l3jpBk8b8zW0ohZsEbErKJxZ/4VVM1oIsPIYs3etr1LVBEV/D/W3pszYb8kybkvqZk1mVrgJneuYocivXzQLtccHqdQ1tt0o9CqA8JifmoD773qSO5SAjgDGAF/KpvSOueMl6ujS0x46Xpm1Gac5XDwZTwDRrvdEh1bIJx9EOkyOqq5fqLO05DOM3nrCocJ+H+NzAwa21tEnYAuA/XuZGUOrtiqwuBdT9rgGkhnRpGPbCmEnXXBmYnW3CAk/BFp0zrtrMSSkEnXantDFvX1MBQw4ZbkGuZBHbcxCdOhBpG5mqwCi2/EZFwWeNrFhDMahd0E3JfrZDHgJq4QC/RD9atob151OLwcefrAzIz2G/I8sORAMft4FKtIT3ODKtXSLG8/+hFuOPTzfIWPXTnz10mDgiXEthc2TYC+9FrrPObO/egv8QDHNAYsaS4oIXAQyLsmJKhcHJ3UHN81QcIvo7RbWEj3QuavjHI0Cz39pBM1rtXOS/REFh8j1vhPSdEQ8oEpxGMWE4RyGvizSdGtJzny3DzcayRgCgL7TVrPqvfmYqV5FG7jwbvzQqBnVtAowXUYEcH5gGnsoqEBdaDd7HckIscUhS8mCozr7mV265ncBUakRYT8iQIFf1DxvauCEnSZthXtXT7hQY6qo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB5744.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zzQ1yI72LD6yMPbozV0+u377efR9JRHC/i/T5QGO6ERNk25V2cqhGmWPLuvvYvbwrlODVPXdgypVFy8HfDGdtk/g8+35Ir3DZb0QRXz5K4PB/VPkBhjd6n3FP23v+X/LdEN+gRh11sdYfIAJ5AxOhkEmPfGSQ36O2vLVhTFRzWyQMG8AOjBJfCGZ62CpAikNF+PAmXt7ykn0dyyWwv8EbuiXwSe1iOWf/DnjeUsBVHrZb8XFywYeWYfhzUN8tYVGlyT8hjiKhKNafyOFShXCArrTmFIrQWfUq2wQwvO17dMEWNKxt7GuXAAci2eMox2Dq6esra6eFH8/yiob28yZRRzNhokiGdi73YbH2Vx9MDTv8QCAHdQEaI+4N8Pq3pu2lOmPNbvjv5i9j43K2L0C4H4Gwe1t6G+pU6pVIu/kYaNF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1C555WNCMu1eObd8NjKovtnMk1QSpDvVIBNTU6yB8Hg2VMi+8UQwgJqQTf/krJP4Pe9t/ybcU= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3da80656-9e10-43cc-8961-08dcabe0b79c X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB5744.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2024 13:01:22.3983 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: F75X5XeByluzv5oykT1mLdYpXLwtwhry+BFd7ffSyE7sQMuCoBXyX0c8saSm6aoV X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6709 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 214C24002D X-Stat-Signature: rz5bhmhgpddmkdwbqtm4id4r8f1pde5a X-Rspam-User: X-HE-Tag: 1721826177-788762 X-HE-Meta: U2FsdGVkX1+x8RjghbezKJDLjjVboOw4K6aU47YbQQydHhlTC3615V3onNX4R1bszIxWpbCiydDmB9/9dRpY0qbqpFoergiW2+ou+3zs+Qrvewt/sCQOHTFYhsyFMqOFnEvE5yWIAvGmpc6OGn/1uR+ec/Nqpwb2dIHyf3GIzxaKXD6J1+KUM3LUQnW2fEKsKhamrF784aAbNEzIJQkLz8RVnx7McU/c13cedB+srdF2fu+KbaVIuRsgDAYG91elt6M7SY9xx51NclkBO685Pw9JWRxltq5sok+Nf/jq93VdjEYl5Ntvaa7v055tWk+DzWtciPiQIDWSRGx6oHXy18XAFK6PYjE7+1uXSjO7QnHRHl5haKiqX5QwpUm7iKtOyT8Oi6QfWgPZPSs4OcG4OAhSsrWJjV646A6pJSYnn3tSTtWT9ywf/1EUu7/m0Y8ohaZIHqSpkgfoSvWwIG07kYNEsTTVGjWWDmHrBHwm7KbfoSDqYGp0dnoQT8or8AK36n51fJj4SroPblXY4SH6d1VYD9Z+numfrKIDEmLe2ERoIA/qX7XGnMVBwkUzGKjRpJGiqun5YNzVSCxJ++/T8nHlkaoXsRHI1hfkICf4sqGUH3vfF2vz3NsVhr/AB5reTfnshw02TSPtrEQiLg+wcta2bGEMhGc4xunIoOrDb9YSfl2ShcSrK37XSQXZuetJhdx13H2zKI7H7BOHwmr3eYCZLvbDdE/0PRplHo6S5CO2taQ8l5+3P1sgHp2h2iGSr/SPXUe9E8TI3K7uilL0U0OcieiKXXO3acG95/olxe1hBxx6NVAi9maou+8stt3+wO45zQ92w8xzXG/g1LVp/azgcNMrf3dL84nntC2n7p2l+3V8z+A3A05SGc5fqKvqnb6FIkHM3KxPJx1WCmMhBQ11vXPZ4Z1k+CqKrhs5tBcfIgIAwRVHIDTl3kYtFdX3/tdaTyea1Zs+Hk1w6QA skQJ1bL4 nRG3FMxXj+pKMrz2shaFC8t4IBGPBip6UOo3VVZCgjRjnOwTfl8t8pusVIZsXtHvLsan6JBGgOcGvkqbzdjg4KnLNyIOolt6ttqPOmnmWGmN/Af7Bzok58jRHTBx6f7yFtw12tsmugCja/q3bUMotytr/f+5oR/ZOFxDUDQRWpw5KAKsVeSBmT4jDAJpa4I8oAtkh/XOmf4hLvILDNSPmvdosXgaEmQ246FF5TXO4HhjXZl82zUCmv3d/HpRy2S9NHoIwpmLup5CqooM429lXhcZpOYOkQHBgEFgohdGgqF6u3Cxt4gGLDcGVApX1VxtG9BAmT7XU9VeTlGhrzg57tXMnWlxTwUVZXArQyRWFfWPTlPuPLguEU+SAUF1g2Eu7c4PJ/5MFJSdWGQE= 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: List-Subscribe: List-Unsubscribe: memory tiering can be enabled/disabled at runtime and sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING is used to check it. In migrate_misplaced_folio(), the check is missing when PGPROMOTE_SUCCESS is incremented. Add the missing check. Reported-by: Kefeng Wang Closes: https://lore.kernel.org/linux-mm/f4ae2c9c-fe40-4807-bdb2-64cf2d716c1a@huawei.com/ Fixes: 33024536bafd ("memory tiering: hot page selection with hint page fault latency") Signed-off-by: Zi Yan Acked-by: David Hildenbrand Reviewed-by: Kefeng Wang --- mm/migrate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index e7296c0fb5d5..826afb82ca56 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2630,7 +2630,9 @@ int migrate_misplaced_folio(struct folio *folio, struct vm_area_struct *vma, putback_movable_pages(&migratepages); if (nr_succeeded) { count_vm_numa_events(NUMA_PAGE_MIGRATE, nr_succeeded); - if (!node_is_toptier(folio_nid(folio)) && node_is_toptier(node)) + if ((sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) + && !node_is_toptier(folio_nid(folio)) + && node_is_toptier(node)) mod_node_page_state(pgdat, PGPROMOTE_SUCCESS, nr_succeeded); }