From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from BYAPR05CU005.outbound.protection.outlook.com (mail-westusazon11010027.outbound.protection.outlook.com [52.101.85.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2B2C3AB27F for ; Thu, 26 Mar 2026 05:50:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.85.27 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774504244; cv=fail; b=nvCWEXnobQgF3VCM6Qi8xeAnDPHtPmoSfXhNuDHZSuYlf9I15nS64Ml8OpB+UdczTOqNV9jPsCRS2iXSsBn61I5/BYywoiTyYnQHX7L0RUiGz/tAkQQXkxTZVEWJ1GzGj7VrHKAdof3J5W1gr3fy3GIpgBOfrlxy97c5pD9T8Hs= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774504244; c=relaxed/simple; bh=4h5ICnO4AnQPGG9r74MK9XYEHVX5HKh/9LyPFoA9CrI=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=RPJ+Xl9NZ+/hkqd4JKr7bfZY0081mdKM3HjlcPTFuetMq8Xur7yJNcVjJtu3rzZGxLGMlPp9O18+1bjK7Ft3Bo92xhOyKq/qgL3TIxgMpMrHc5ZTBctrlWJLXOdeMAU4sJtEQMhjZC+RYkRT1cu0geqwSIoaLw+fc68Cqo3jymM= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=b+qCJDFD; arc=fail smtp.client-ip=52.101.85.27 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="b+qCJDFD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NYMFbKMp8g2eGfcnQ/ISZgQhWEzAj6hiLGgB7Km0WijpqArpR6D7o//MjEdxYHwi9chcdXK4pUx8dlE5GPiJwGlTUjFNDLLZV7SI45vTyRqkua2SJQTnX63D7Y1GRDEbTDQxl6RQzc2PwYkMAVx3Fc4axQ7/R1ebiM82UIniOmP05YfhbbHLzyI4nfti7kOgZ5xqTYC6T8qXAGph74LuptIZtYv4UwUBlKQemTMs4+Pxaco+VwUwU+xs6bf7FIo6/GL0WYFa7xxqaFzquNWMBizWjov7ef+bFFlvh1NJzXjXprvxLN7mFCHmtZve3Q9L3xy/yOfG6VlKomvpC1bHDw== 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=pNB5padoOWlvjYbphTaRwuf+94RYO5+C5D/RNAPni58=; b=iXhVckKagsJnMRhj9+PPh2N5zAszJMf8N6PlxWFTpiAYLmglX3bp9L6b1ut+fTBqhND4CnI6vZuEuBEi2UG3JCksX5Dk7wEhBtvSVVGQf2K69DMNAhNPT6DcmsOFgVflJBIavwUReWa7QnUpP3y9sUfEMxtNNtqvUFf6Pv68rJ1CNZ4Vy6f7EVgub3w6nzjUp2tehlDVgK9n9ZsghnwJeBo24vY3SldU5hqPEiiV5j2tzzrgb28Utg4NXyYSgSrHaqQAQD76JXCXSZ89dUzpIUJe1kV4RN9QUiKGFMWFpXEZ067H/SJfO7ejabGPgl6aGDnDOCXGl4gvSOp8Pv4kog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) 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=pNB5padoOWlvjYbphTaRwuf+94RYO5+C5D/RNAPni58=; b=b+qCJDFDWGaBN1EBYpNdFtlFp/N26Sf8BpCEpJAj7Q6ee+B0Rya/sPZlBl2aBe5KcYnxi9vYVu+y6EfOT+LS/ARsKXyDq9hfy34l5x93ICCQs0G9b50cWa6AAZJ7/KxIH9RzMG0vnSqZ9NA8UTwkcSXZbZzDofUg/CBSHhvxnVk= Received: from SA9PR13CA0013.namprd13.prod.outlook.com (2603:10b6:806:21::18) by MW4PR12MB7166.namprd12.prod.outlook.com (2603:10b6:303:224::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9745.20; Thu, 26 Mar 2026 05:50:39 +0000 Received: from SN1PEPF00026367.namprd02.prod.outlook.com (2603:10b6:806:21:cafe::e5) by SA9PR13CA0013.outlook.office365.com (2603:10b6:806:21::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9745.20 via Frontend Transport; Thu, 26 Mar 2026 05:50:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by SN1PEPF00026367.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9745.21 via Frontend Transport; Thu, 26 Mar 2026 05:50:38 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.17; Thu, 26 Mar 2026 00:50:38 -0500 Received: from satlexmb08.amd.com (10.181.42.217) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 26 Mar 2026 00:50:38 -0500 Received: from [10.252.223.214] (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Thu, 26 Mar 2026 00:50:30 -0500 Message-ID: Date: Thu, 26 Mar 2026 11:20:25 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v6 2/5] mm: migrate: Add migrate_misplaced_folios_batch() To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , References: <20260323095104.238982-1-bharata@amd.com> <20260323095104.238982-3-bharata@amd.com> Content-Language: en-US From: Bharata B Rao In-Reply-To: <20260323095104.238982-3-bharata@amd.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Received-SPF: None (SATLEXMB04.amd.com: bharata@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00026367:EE_|MW4PR12MB7166:EE_ X-MS-Office365-Filtering-Correlation-Id: fbd925df-5f31-4fbe-d687-08de8afb9bd1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|7416014|36860700016|376014|1800799024|13003099007|18002099003|56012099003|22082099003; X-Microsoft-Antispam-Message-Info: RcSV04LhffDHb0ext0PyFmHR9wgCr9HoG9teo+jtbC8bMNMqZXg91qLA3cnt+1ITLv0jQr5acq4Y8EgkS/NOPX16qiFaMnqEJL6jnGjCHiBHsjDgM9BuwgQrpkQ+ITHnI5ZN1knvSeZ44bQ3U1fijNuv7UivTIhjAGoyVcqx5Smn7kulqGeYlkp7cOCgXPnwhimF2NpidG5Zeg94bcflDU4YfE1jBzAo2IfVk+1OFl1xOdMOfdzlBOYZQXG+UfGaxzNmbNk684F3iDHUtwWsAv5c2cXlUjppd2B3JTAFFma75I6RCkeDKG9szqDnJu5GVNkTe/2by4VPHCHaGwkG+vlXDp8F8tgYHTzjhaqsNEhcb+wjHNkKXs9AXyP+DBbA/AmwsMFZOxezO0YJq5r/7UquFZjFCuTcjna/58Yasvy56mbw7JZvux20txVTdLTvAeExAROte9uo3BQf82++2AD1/vJPAchLNj3/eR6mHtk/Ha2eFayHNKGKABvkIcKI3OXrwkZ7q6wZRwVNrByPlbx5Xbg7HxW+YsDShO88b4ABm7ZqVSQMRvM3I0xVKrxf5CIjtFKpTCUyjVCjwTCAKbGOKr4RymBdzAHd/zEG4SIkcL2IiKJizRGuHQsWbQS0CJh7sVAQmZOFubftDqW6r2qaJyUki6dj95CUOGzQGcaCMtFzAnD9UVn80BDQ8gtEXrYa5Pwh3ztIqkSRCUbsJg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(7416014)(36860700016)(376014)(1800799024)(13003099007)(18002099003)(56012099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dU1MuG4VAQaIrQNsh84IzmVS9o7UXzIQ8Di/rQXlW13Un4OiV3W0m+8U5jl0vVzWacWaAriCTNYG8kswyyn0Uapn1LCaYJBGQISRyVy0/VP3ZDuv5huwhGxLryh2BxxntI7fTizTmaIcG94nqcO4T3PyisnT1aQ/riVQxmtoIdJEEfW9wMhbUUEffLPCYXWLv9iPMRT45K/LaVXPhQkrj1/Qggpzi3TiMo80WNAFScuyVx/6Gimixmr3L8vVgSTMQ22oF9XvBtqgmJwseDYYIou16WsYdUqtLD2X5Vff6kefCXKli8pgsWPrTUrPjiEeoOJl+wUvx8404QbjQGSG1vND8plvztBWzrjUtE7Zh+j7RV77YKEWTDtzou/+JgMwnmSJJieFaljcSeAcvX+KbcXQ23wv27tU7oYYt8cW1A9ew+S7S8YqwKadPpW7WuV4 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2026 05:50:38.8218 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fbd925df-5f31-4fbe-d687-08de8afb9bd1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF00026367.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7166 Replies to review from Shashiko [https://sashiko.dev/#/patchset/20260323095104.238982-1-bharata%40amd.com] >> diff --git a/mm/migrate.c b/mm/migrate.c >> --- a/mm/migrate.c >> +++ b/mm/migrate.c >[ ... ] >> @@ -2751,5 +2751,53 @@ int migrate_misplaced_folio(struct folio *folio, int node) >[ ... ] >> + if (nr_remaining) >> + putback_movable_pages(folio_list); >> + >> + if (nr_succeeded) { >> + count_vm_numa_events(NUMA_PAGE_MIGRATE, nr_succeeded); >> + mod_node_page_state(pgdat, PGPROMOTE_SUCCESS, nr_succeeded); > >Should this use mod_lruvec_state() instead of mod_node_page_state()? >Using mod_node_page_state() updates the global NUMA node statistic but bypasses >the memcg-specific lruvec statistic. This can cause the pgpromote_success >metric in memory.stat to undercount for batched promotions. That's correct. Earlier, memcg wasn't available in this routine but that is no longer the case in v6. Hence I can get lruvec and should be able to use mod_lruvec_state() itself for PGPROMOTE_SUCCESS accounting. This will be part of next iteration. > >Are there missing topology and sysctl checks before incrementing >PGPROMOTE_SUCCESS here? > >In the single-folio variant, this statistic is only incremented when: > if ((sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) > && !node_is_toptier(folio_nid(folio)) > && node_is_toptier(node)) > mod_lruvec_state(lruvec, PGPROMOTE_SUCCESS, nr_succeeded); >Unconditionally recording the stat inside the migration helper could >corrupt promotion statistics if the function is ever used for lateral NUMA >migrations in the future. This routine is called only for hot page promotion by pghot kmigrated thread and has been documented as such. So unconditional call should be fine. Regards, Bharata.