From patchwork Wed Jul 24 13:01:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13740942 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 51786C3DA63 for ; Wed, 24 Jul 2024 13:03:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E6E776B009B; Wed, 24 Jul 2024 09:03:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E1E6C6B009C; Wed, 24 Jul 2024 09:03:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CBF1B6B009D; Wed, 24 Jul 2024 09:03:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AC5536B009B for ; Wed, 24 Jul 2024 09:03:16 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1E2224091C for ; Wed, 24 Jul 2024 13:03:16 +0000 (UTC) X-FDA: 82374661992.24.3837A9C Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2062.outbound.protection.outlook.com [40.107.94.62]) by imf11.hostedemail.com (Postfix) with ESMTP id 0C6A64003C for ; Wed, 24 Jul 2024 13:03:11 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="N/yMKW7b"; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf11.hostedemail.com: domain of ziy@nvidia.com designates 40.107.94.62 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=1721826138; 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: references:dkim-signature; bh=MMID4ESwDtEXPhHLauGyWaXLbkAmfGD6JSMebw5MYTw=; b=k0JfwRyxGeb5CtMjczbupO7KJHoWcHtHy3Adw4PDdznPMSKbrE/l9bY06pLDnKtZ3spmTB oBxLS9wwkQdUMjqeyfpIuayh1G2YR7SjS01iAw08b87+yTZVg4+g/MJJ+ngyXzaXZ6zh6v oaWDL/3sMVWIrUCnBB7AkVpaq4cm4Mc= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1721826138; a=rsa-sha256; cv=pass; b=oSiLgaBA5tKNUHzfL5BCIogooIF9bNziUCS+B5iYvxii6PpJLHt0jY2PVDL4dACDNwaDNJ ZObHjJeTmurnxNOrk24r25QxeRjCHouN4klfEfGzdnYvLAypmNhQiS3wALeZw4cNN/6RYf 0irUjqmDwmz2jryrTNpJyVMpCzPt6bQ= ARC-Authentication-Results: i=2; imf11.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="N/yMKW7b"; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf11.hostedemail.com: domain of ziy@nvidia.com designates 40.107.94.62 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=PPsYWs43dzfm/dNBrWO8EgDukV/2YSc90rtX6i7xcBNRdrzmvMulK5CRv8OG+w/lBmVOEjLVY8U3yXnu9qBUNVcFuo2+Cb+gqaY/A2yu7rLHlfoMbZwaDeP496vp/VsWC1ThIoZVcVU/L8ScQiqN/y0KDUw9ZeGEKJcfz8dFp3RxFUwsnIvaG+kBjIN6VI0BunBkov9oC/HYUQIMP8za5OdFNu2o1EzJs6IBLxDrNUO5fVRCRMzZsLxevi7kvkb5KWPbbHl0GH8XONh33h6UgJ+bw+mhrEikDsqYDPmiZKA6/xMMA2rzNi0Vu53uRYDioSu2M1K/FMe1qawpqKt8Gg== 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=MMID4ESwDtEXPhHLauGyWaXLbkAmfGD6JSMebw5MYTw=; b=OE3dI0FYwDBCBG8GasM76RYiNcHG0UoHPAQ57ZK1DhOZ3vnKdY9Mj7Kmlybx376j05a8E3stGd7nnQg60Wtnz71cxPipMxy88Vp4GYhbiFq9fXZeFBCmmo1Pnm0o7hapjApMIKEXCQTDuS8ZccqrhJjS3lqyIoYmdzlR58ebEiafe8byNQSABokeWyxoaqHYhm2Q6hF5ec4NaaZXL6jZKQ5RiCsYa9Qb+KFXXqfOnw67QaQQ7s5pLK9NTA9WZZb2H+oJW+jP1bowZZUdJnTyvA5PjdHf+s1AaD8D5DWsYX91al7KidiCOY+4JmCXrGVrVkAN9O+v6sSmuSjDBdZptw== 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=MMID4ESwDtEXPhHLauGyWaXLbkAmfGD6JSMebw5MYTw=; b=N/yMKW7biKs9JIvMHKKMwk1YvOZEKe+DEGQCD8aNPsGbDYnbXdXV4XI2Lu1saVauF680qI7gqjKFyqilnD+AUXt9N0kk9yuj5XpTcYlbLh82KpfMy8x++4n2Orf3oOl0cG8P74FD8105UGuN98eMO33nalIAxJRHIl/HDbEAT42v6YlG4fMao9MDWNaPsFdb0ToJZxLRX0XPMFl/mMNCVclPXTifkY86HQ+qiGmYGVR8MUMvB7hNNgeDCqUTsMAExrRViSbCg79YGu85IwkWy0ip8oTJqu6RCFchDVTMWZV6RndhZjEelVpS1w5qKOsr4VvP/IJag2ctpSSW9BUFpQ== 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:18 +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:18 +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 0/3] Various memory tiering fixes Date: Wed, 24 Jul 2024 09:01:12 -0400 Message-ID: <20240724130115.793641-1-ziy@nvidia.com> X-Mailer: git-send-email 2.43.0 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: f3a38941-70c6-4e71-f039-08dcabe0b532 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA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8b6nEfjd8tXothdPWQJB+GTNvB09LuqULPxTxQINwabk8zoqOheIwo1m1HdLpkWi2PQQcESM3ql0XMbyStj3P/ZMmGxX1TaoxcRhShgAhOcvnNfWHRxgIpo+5MlT1Us4Ata4UkYx8EJLZ1Sr6JbPak/6nS4ymA/m8kywh5qy6WZjr4eQOIHClxt9jC7v5ATnukcjJFKQBxDKWicu2Y9WA4sSZRkn0ZVlwyre7o2KL0vrqxtLC9NqEPcQsGyh7CvDa+JPFYrBf0wR5Xi1ZW0Q8cD5owLFRZsoOFqJY8VnGpUYd+tBHNeEtJvles8ncujTFZfLA== 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: xjD5iBc+52yZD0MjW5CaHD5zncArNPwSIScQlu4tzpZrIJotOHYpseCsKe4Bz+xfY7nljZTEIYVDiKyIUFbIDbsS6wqHb+DzsGAMoMsKe7zbwCMoxTWjZXtBV75F9pd7vYiPmRkH6E1eLuPI/AFcSilry+JVBLsTvVekP0sV2AVrDveyDoG9x197QjBzVX1O8RMEh/e0uANtmOKrWXc9i0NFEEddOir7uc3+F3J/xuqpwwF3gneQgi/hluaBDX3i9Qm9GAMm3zbJoLgT3KrAfQ9H9XvlcqzXAQ/zdH2h+C2rykfQwgPQLjpPNHuKQDZq8lDfXOKRuHIy/C7gtCbe97TtyJ8Qww8IqwFhaxSaLC/p5zCHeopUXH7r3EjVgrdKLiDs9Lwa27njplbCHuB5K7aeq9KmGCvdTAjaAc0Wmy2JzRCAQFSkCuzIplpTbCDRGQGZUrRBAAyIdsUaZzN8NVJRpM9teJXfBFes5rsOZRG/W/D/TTzplksyN+/Zq6dRSjMCQiC2A95znP1NiQF+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-MS-Exchange-CrossTenant-Network-Message-Id: f3a38941-70c6-4e71-f039-08dcabe0b532 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:18.2382 (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: ytpoV9MUbYnsmBrtthyTjY4aHN7vjbxJbHlMUz6W7lAFwS4w6vHLL7gZZED1nyNJ X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6709 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0C6A64003C X-Stat-Signature: hntsbc41s8uhfha8tehju34da7gta4xa X-Rspam-User: X-HE-Tag: 1721826191-181039 X-HE-Meta: U2FsdGVkX18Odfmw/mBiW1zY6s9v4jqWcm9DqE38LPDXGLK4CQAI0LifMxIUAswFNGbshwk/lIrUrD8Ba21UXF0pNSfcvKRsp+qZ6sB54hIrLEqXTfpNV68FcpUkcSFV7+sb60S3uzmuyrwoMIW0mr7Mx/BzvjEGCQGbWYEYKeHSl0/FxbqngMCdCryMvkioe7UcqZnTyGLB5FChkBoP7L75eH/xKXCKiXGcYDpkSpRzHvrRE+XIWF0FQsMS8wu77ktpDEtAPF9gQFFGxDrEMN26QBbEEC59KQW0uxejbvneyXTevnWjJMNflouQ734/2De9GQUYfCbB/SRNvIxfHcJCq9xNq6+kwcZcPh1gBfku7lORgzH627ZQ2+NTjOWLy9M1XSflwYgJgF/Eq2GKkNjjhp6+1GUOMjprBQuyehudSDUvy7fV6jBlb7Q8vc6xc3P4Zvrevfoed+YpiCo1+xCPEJB0OsA4g9uEP9BDpNLPDQz9NoVBMpTQd6LBHA2fA80fVvUMweQ4mrKqzXKFB6NTEjFGlWfY4kRXiavBA1omrwdhIR9MQQzVnXtDa7+RqLAAGdStg5cdvS3PfMEN0w013H15vBaUDzU1RBsDj5y7mpcwO48QGoYO3AUh9k6ho9BpZlbL9CWdV/+Hp7aXhSAY+rNyaFSIPHNg+wws9hvRr5oyHV/pzo+fxInBnEmWOq9VljySNuVZTlR3KNAa9fWyZ97/9Jwq9dqVSxxXmqva9VHlftPy0iZWPR4FDsNglfe3ZbNwjmCY+nEEve58KFHsyWrgvRAP15I1rvGgk2tvMXDvZeCTkXWCOIMll8ePDQZHUsaDlURJ5QXmQUuuHlt+SBT7PR+qqKgq3ZMd/fVTr3wxnrbbMAcx0fHBkCUg03p3QCPCmdLStJoOykwj+KZ1QPUg/EYQhu09R4YaqEJM9fy5FKeABR0iKE+IlGcSQAHoIHIuPWh2O2tZ6wz FP4VkOLD 9QWPQbrhc8877cv8UXEwI9mYI+E68RLePeeqzqWg9u6Z/KwEe2EoO62h9LKcpmAn2TNhdoZ2jW8zPLi8JkcXGBSo7Iz36unr8HLI2RnKE31Bf17rnj6FSGHaCb/QnJLxCKWo+ytoUMxaXfvfUycPBegQhkd6VzgICO8GiMQBndGpPDKx7nL9rlsn18vHt0FDgbdwM X-Bogosity: Ham, tests=bogofilter, spamicity=0.000412, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Changelog === From v2: 1. Renamed folio_has_cpupid() to folio_use_access_time() and reverse the code logic, since folio_has_cpupid() = !folio_use_access_time(). 2. Wrapped folio_use_access_time() with CONFIG_NUMA_BALANCING to avoid the function redefinition compilation error. From v1: 1. Added a memory tiering runtime check in migrate_misplaced_folio() to correct PGPROMOTE_SUCCESS counting. 2. Moved folio_has_cpupid() from memory-tiers.h to mm.h. From RFC: 1. Added Reported-by and Closes flags to first patch Zi Yan (3): memory tiering: read last_cpupid correctly in do_huge_pmd_numa_page() memory tiering: introduce folio_use_access_time() check memory tiering: count PGPROMOTE_SUCCESS when mem tiering is enabled. include/linux/mm.h | 6 ++++++ kernel/sched/fair.c | 3 +-- mm/huge_memory.c | 5 ++--- mm/memory-tiers.c | 19 +++++++++++++++++++ mm/memory.c | 3 +-- mm/migrate.c | 4 +++- mm/mprotect.c | 3 +-- 7 files changed, 33 insertions(+), 10 deletions(-)