From patchwork Mon Jul 22 17:29:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13738980 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 28FC6C3DA5D for ; Mon, 22 Jul 2024 17:29:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BAF366B0085; Mon, 22 Jul 2024 13:29:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B5F706B0088; Mon, 22 Jul 2024 13:29:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D91B6B0089; Mon, 22 Jul 2024 13:29:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 7F8606B0085 for ; Mon, 22 Jul 2024 13:29:45 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 299691C417C for ; Mon, 22 Jul 2024 17:29:45 +0000 (UTC) X-FDA: 82368075930.10.21F114B Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2068.outbound.protection.outlook.com [40.107.101.68]) by imf20.hostedemail.com (Postfix) with ESMTP id 4B12F1C0010 for ; Mon, 22 Jul 2024 17:29:42 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=byzqGfah; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf20.hostedemail.com: domain of ziy@nvidia.com designates 40.107.101.68 as permitted sender) smtp.mailfrom=ziy@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1721669348; a=rsa-sha256; cv=pass; b=rfLKVT9McSVGO2/iejotoGoDUuY3sN0jmdKiT1ICXE+51iSwy60zsrTda+grwpx9XToeqw fgh2t6uJlw9iCjs/uo7X3YvtwK/sVfD9B8Ey8TOVUD/E04ygO1tCJPNq/YakQfmZvbaoU9 k40Am8zOIRi7+RrOKUXys3kA+nbRClg= ARC-Authentication-Results: i=2; imf20.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=byzqGfah; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf20.hostedemail.com: domain of ziy@nvidia.com designates 40.107.101.68 as permitted sender) smtp.mailfrom=ziy@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721669348; 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=abeVhQpv8bi5AHWi4oC4YqHkrMU7IYRkJWoM71dK2iw=; b=32LG9/miQxMtQCQ72DHYnYCq/yDmLNzYEvNyv/lGeSnvWGO7l5LodlR792qNjxgiO+VcY2 fPBw+80VEKmqV3ukzpyVqb0Ahv6fFj+7YoNbQv9/BRj4co8D5Gy5aQ2GHViaVfm+vZmXuh 6FlvGlSPdbumg45jHzbMCxPHrPTUIFw= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lMKZoxxs2UmzmJa93plXr5tBFLdQm0oa7IN87ivdkMUrFD6zR5Cs+K7rANtAZvX6ehFWtKWCkBg/on+rD2wGk9LSEV0rJP8niNxGnaWNGH2oo1r0Z3vTKcLAaZfX2ytd99Qoa0+HXK3D4oNGPdqeFr12B8MtaFHTiB3hoqyQMgZugb0oLc8VhlbdwN+7DThwanVZjVMWG5X9Bh3+g7z/ecbgIMAqvtmyabo96vDCX6esNfpPvLVwuZJ9Iu8Pi9sVfSdKmwkFdaaRYGxtnLQbOV79nFW5opx9XIIbyZj9hJDBT9qmma+LgWnUB6il7NDbSFXJj1/BlyZtnuv8YxmGWQ== 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=abeVhQpv8bi5AHWi4oC4YqHkrMU7IYRkJWoM71dK2iw=; b=bg/yKSx61a34F769A3Afxu1fID3xGFULncLzoS159XNfsg9CUcEiOEfpEKzgvNDGGE5Olf2wzD5ZqlRHFp4HwyEsAjqqgOmRXH5EFhSERuXJzgtnaiFOfEFzr0rT4SZH1mIbudN22qgI3aMkg1P/uYvM7vijOKKIbeaUn6cO2bzac+EzQrvOK6oYEoElqMzgNcnT6BALAEYkIjw+xDNvoZjgdOkuOcGnLKwv8nfYb6MehpR5s2vJcJugLvclfga9Ic4c/jWab4oXRQnd8/a0WHEfL9OSClDzqvBY0dYBme3tUVaUqDV6BCQnXJzzTUk9n3v1JMbzkEZgh3uc8r2Tmg== 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=abeVhQpv8bi5AHWi4oC4YqHkrMU7IYRkJWoM71dK2iw=; b=byzqGfahkj5ucKceEntuVWOzlETRgUhaK7s8NEoyPQddLeRlS+uD/Jcluf6emmXx7RSDlh9EYEbNgymSD0wXyLUt8qEoyqfJIt53FgsAI6K9vDJa+Pl99IkQzfL4mrnr47u3WzTGOZpjQlRYPtMnCgvwaudpgMjGXFxApIKtoRnUvrRp58eprjQLYBa0Dcr2T+jVZBSYSMrqUHpIKLGsL/cARH4f7OOKMaWMbAYmSkDwk7PYOSZ4wB53tqbWbIjIMBXz2JAse3GhbIA8pDz/kaza2qaCjRd6Z6/Ej7oBOIOSaqLnO81bGVnF9sUa8/yS/F9LE8sBI10M8QNChl0wLQ== Received: from DS7PR12MB5744.namprd12.prod.outlook.com (2603:10b6:8:73::18) by SJ2PR12MB7944.namprd12.prod.outlook.com (2603:10b6:a03:4c5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.14; Mon, 22 Jul 2024 17:29:27 +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.013; Mon, 22 Jul 2024 17:29:26 +0000 From: Zi Yan To: Andrew Morton , linux-mm@kvack.org Cc: David Hildenbrand , "Huang, Ying" , Baolin Wang , Kefeng Wang , linux-kernel@vger.kernel.org, Zi Yan Subject: [PATCH v2 3/3] memory tiering: count PGPROMOTE_SUCCESS when mem tiering is enabled. Date: Mon, 22 Jul 2024 13:29:17 -0400 Message-ID: <20240722172917.503370-3-ziy@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240722172917.503370-1-ziy@nvidia.com> References: <20240722172917.503370-1-ziy@nvidia.com> X-ClientProxiedBy: BLAPR03CA0064.namprd03.prod.outlook.com (2603:10b6:208:329::9) To DS7PR12MB5744.namprd12.prod.outlook.com (2603:10b6:8:73::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB5744:EE_|SJ2PR12MB7944:EE_ X-MS-Office365-Filtering-Correlation-Id: fe09ea3b-d43f-447f-4757-08dcaa73d598 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: gI+yc9wiB7dIsN4/nuMz840TS6L/bx9ws2gfrKckFKMJPnAlDSn085UmE2/XYtZNdzDlz/oPRQhUzglEOtj2ePK5CvF+L/Lzr/JGEdkVagNI3V/Ft79xQ0iW8VfjyKZnzv5gczvVjx7zncKcv6D1MzwTmmJnMgQ1sCUfPyTTOmqD4V0sRtjbuIOdjwFTJRUp/EzjEepqHR0zkD8warGpQVHHMMwrU6t/Aq5g95QOKcHmkURIrQqqH9vklN1LlENtjMeiC+dLq9mQ1/3h3D2UfbucgoJZDuxto4gxEdEq31paYgNX0IAeH2/iYZOaFZsvD3fuZdiA50WDZ4pT6gQkZHvrJ+U2QwX5r2KAvlx4ZNRM/d2LxBitCGMDYjymmp6eO8vjjk2hMipR/+/jLPAaY9P75zQeUya0HZS87HHARrfKdrW13MIwoulMO6+uvCbOBrcK5d1efelZPAyZokT4GHvzb+x8Hl8Z/XZqS3yDtbIWeR/H8PFY9Zi3KYOsqQsDxLhFrzhxvOWgE65vWz0h6+zKEQjxXIdSzLUIy4bzv0IKYyLjFdVNT6P7wcggmbsKNaS9YkKT89FCfdC7diMJW44m4W1CQ0F1mOwEGpTHEH4ONP+kP0Yk9G8huwtmTxIS0dU3DN4PCTOS2W/8aZ1EG+Zutay1/m9FZw1o7DlWcKBiEfJXkrNuy37+D8VcVyvQPPzjD4nWEMLNMctIMRxyceO1cYHRQ5LpudwwjPNcdgoV8mqiqrRdrS5rWzToxHgGmASsf+w+DHivk8gw23E8GkOA2aVvYFJGnJ7BLQTBPlg6yU20m7CGgqSp2GzCzNJ5zcy6iSaCnS1gtsB3n+5f85zLi7V26cThTEOflOhsTBE1VjRBTsJSm/1sjXtpQ+TI4gPgciEXhf5iLC+aSBCsSdkyRcOcCE5fykgaxKA8uPADypInSOkuE/ShMn2GctOSdokubL/TK+T6aQvtRrAQ/5OMlL4v3QuZtxdUB6XzzFvkvope4BiOrp94wlQuIOD4hUvSTrTWvysiAxzy+qSj0IYLPavE70++VHSuPob61fJS5pgCwdhqgtg5GbfGtk4Khcbc6hTO/Jq34zKz8A+LhOGbd359/mE5vYv6xshEXeb4hhIdgX1JWywMRBFxERm4GSP6svcKkg7uaoeZdoJkicj/h+BnG14Oi/t1A+ZgRAm91pOFr+iH1tHWYBhXGUr1OCf7PiDDKHaZgIljpax/rKvWE3jkUBLbep8Hcr8t9V8ghAKqpMRb8wn5eSKwvuPnnodBInzgZdb2Kgg/0/3hF5wWq/6n6S+CJhoHD2oWYkYWKzASargS1HUBubABrt51ZA4F6pMLnsAXRh/ZW9hSTUqhnNNVWHq2GXobW7u8pl8= 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)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pZ7HZ8Xi++lCd+ZMkvDThWzUVzdKzDGPtIvo2/eNWKN7arqG7GRLMiW7vSQFqio9ckKJoxSWjDaj6mQxhelUmNHDggiAKWkVcwCcViP1QdWr2Ojcop/O0kEzuYWdQbEcE8senDrUCpJflSF5rqKswSqtF6V1puVCZTphsF/CygSUZJi63DN9qvy6WWeVaJAllPosYikfras/z2mXTM6jWRJFRrYgAH9lYESwnVs+B41O7rz8EK7FXVgKpvCvUbSGqcOP9HHkT6c5+C+KytgxXNa6IdIF2ZUePlj0FmjTiYDZh7iE6jTXFj1/K27NsP6FXU4Mf/XbPniwFHTh1YHV+NOgqWaQYQupeX1l3z9YberrS/Ho/dkoIyzkLL/R8VFrBp0SEUw9V+i7ZmHBKmQWDIBRPet1dpgM2U/h32sAPraCmWNHtK99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l6e9NHCVrrVmVWVcB2mQ52nEE9nllGybNxwoEAoW/WBsfODPAsT0ksFFN4rw= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe09ea3b-d43f-447f-4757-08dcaa73d598 X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB5744.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 17:29:26.2515 (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: WKquAQ8tIuZ7Q4OejS+hs7g68br9fL/R+ErAR1n3SJub9FOFb43xF8OW1csG0xd5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7944 X-Rspamd-Queue-Id: 4B12F1C0010 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: a7bsz1grawnptebkicuy8ogy345u7gg8 X-HE-Tag: 1721669382-195355 X-HE-Meta: U2FsdGVkX1+tp9+HtEsgBNFQWHOnGs1hbxyBDP01MM3SJn5KERy8JSI7Wa3LcHzk8oVnYjqgX4k+dpCUflqR4cy3b3nFbWK/7231oQtr0YUjfqs2rPVyYAnFG7b9fAJrKWW7wyUkmof+CBuCfimottSUkm8bVXKZAqbabzqRwl+PdPNgRMXWqme2sc2txYMboCtD1pH2IMf7bTOpB70CT2RodwekDsinc3qenhECBWBworBqKagjI+URATWTOOYJFccS82D2xMI4r7LXCeVvp7hTFFllMRlgmLIpBXwEXpejBQMJhjJb3Ln6aRseMeT7tv5L+RV4ahhLv6SSl2A4o1CfTGV71dEzGCxGVROmGvXjdh7WxOg1Ng59e3i120GaHV9JLqrGkwIOq+9xbcjOrSmKeNXwEcv8+8nMJdhPxqfQU2rg47Btg1+HNEbHEiAuZY2E7uPMr7osXWQCNooBxe18NlFcybILnPjQOIf/1zfKPfCg+PyZ8ZFRxD4XCd1ZqrLM0W+lV2+SFJqhaYUxRsjcAz2E3ZFTthLlb/t/bo29XwjQckhQL6FLMm42BmS7u2OgEVOCXismSlzBWyXBX8pd1TMEdd7q0NG0R7/pZSghANJxxPRBrlIzA/RfrRN9JPv5YXoJyCPSoqmFE3qMiefjKqdEZxcnxLtYaB08TNYuA+DZBzwJ3Mi4LhxiEg563fyMJb/A+mUtn2CSs7AV6h9Gdw99JZpXFFGwszHQVOFDagpcR+RguuhXQmXqbM03bQLoiTJm6esrBqsUUeaBmK9/rOTiwaGIL8Rq+hwi1uyT85yRAIBwfiMUmbcMF6PhFVXS7AicdhQnHsDLRdTmTQr7bEcPKzZo8Cz5EI10j84aaf+Th6Uvsd/1nhH684DMdFwm6LpYfyoZCJM3a3vD7a9iau/WLKcpfT0YHg9GBnQTcFFtC0jHKAoKOxk148qb+Nra8oO5ZAltdTuCt0m aq6e6Lvt VPSogiiIW+2Cttdmd6FArXl5XUAVOpXwv4S/sFCOViAvyJxjH4+ZGBkH8/bQm5Qg7JsKL3k7beUgzgXiOacxvaSW5iNUk43re/tgHrP77PQZxkDebC3tytAL2n1w7hyZVues2Puhz6qOUBNOogNzx1JR4Pk5Wh5QbdPLJpJXa7i6puYKx99YZkHoIgKZ+v8GISjvbXfSiPsIilMq+Da6uA3vJU6FOeqW0CR0Gd4TfVeif8U3OWY+BE4bhaqdNuu7NhVDKVe1ANaqJEm7aHekkC1J0e01UFlElFGHyuOQzgI0H65DOMvG3y/CK3xpd9aVx1V8CwVeGiEYe7Voh7F6ikz9qlwxaI8IhGnp6lTTSTZ3IYwOIfpAn7vNr5PqlC4m6C52VBbU3WnLhlJk= 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 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 bdbb5bb04c91..b819809da470 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); }