From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) (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 8AC4321773D for ; Thu, 2 Apr 2026 03:31:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.113 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775100681; cv=none; b=qamGRpVNJrJJR0IKtYiO12+uRWIoZmAIW/+07/rGbXi1cvIhfK44NpO55Xqf3IoWCGYFzxrZHm8SqNZFT0TcL/HqSSh8uJqQrXc0gtSHMRLdu6qE/wHj7jkCoOWoaLqpeYk36WYD0yVPKIql6J2k+RANzgRw8NhnpmsPjZfoSVQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775100681; c=relaxed/simple; bh=iLd9+4qjxbix0weY5RhPDjwAxVlfiIoUIkaRW6xs7oE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=upoitWD5EOv0h938/PiAce94uWgB8meLx8VTdgdznyH4C/Qe+C8yeJ2GaJJ77GDE8jLQUH0IHSlFmDQIHXOPT3TfYQMEl0CwKsctk+EfZhTdrChtFAobLMwgOGCHYaNZ1rDtPXeyYCRt4ysOxlB+SY44YUFwkcuhWbk8J6Yb+Vo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=TgaUM6C5; arc=none smtp.client-ip=115.124.30.113 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="TgaUM6C5" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1775100670; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; bh=DNIAkzRrtcgVKLAuk70sqGmrTfww7dBSw/i9YQSrGtk=; b=TgaUM6C5F5SBoe5R8L/xfLA2I5NUjC5kmJZI29cN8J6LBM26GO4+c+R92VPLiLrtcYLZtPwbvTUlMHfuNK1OECe6CxFObOzrPkHhWaM2oyWMuR5O7RgoErufK8vEqbSH+pTdjh9lQbM0snLbt+zGtzR4vYXX7CUCHOYsI1LI5IQ= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037033178;MF=ying.huang@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0X0Fk26l_1775100667; Received: from DESKTOP-5N7EMDA(mailfrom:ying.huang@linux.alibaba.com fp:SMTPD_---0X0Fk26l_1775100667 cluster:ay36) by smtp.aliyun-inc.com; Thu, 02 Apr 2026 11:31:08 +0800 From: "Huang, Ying" To: Andrew Morton Cc: Donet Tom , David Hildenbrand , Ingo Molnar , Peter Zijlstra , Ritesh Harjani , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Baolin Wang , Ying Huang , Juri Lelli , Mel Gorman , Rik van Riel , ying.huang@intel.com Subject: Re: [PATCH v2] memory tiering: Do not allow promotion if NUMA_BALANCING_MEMORY_TIERING is disabled In-Reply-To: <20260401172220.fff999a33e3ffcd0d1fa8929@linux-foundation.org> (Andrew Morton's message of "Wed, 1 Apr 2026 17:22:20 -0700") References: <20260323094849.3903-1-donettom@linux.ibm.com> <20260401172220.fff999a33e3ffcd0d1fa8929@linux-foundation.org> Date: Thu, 02 Apr 2026 11:31:07 +0800 Message-ID: <87se9et4w4.fsf@DESKTOP-5N7EMDA> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Hi, Andrew, Andrew Morton writes: > On Mon, 23 Mar 2026 04:48:49 -0500 Donet Tom wrote: > >> In the current implementation, if NUMA_BALANCING_MEMORY_TIERING is >> disabled and the pages are on the lower tier, the pages may still be >> promoted. >> >> This happens because task_numa_work() updates the last_cpupid field to >> record the last access time only when NUMA_BALANCING_MEMORY_TIERING is >> enabled and the folio is on the lower tier. If >> NUMA_BALANCING_MEMORY_TIERING is disabled, the last_cpupid field >> can retains a valid last CPU id. >> >> In should_numa_migrate_memory(), the decision checks whether >> NUMA_BALANCING_MEMORY_TIERING is disabled, the folio is on the lower >> tier, and last_cpupid is invalid. However, the last_cpupid can be >> valid when NUMA_BALANCING_MEMORY_TIERING is disabled, the condition >> evaluates to false and migration is allowed. >> >> This patch prevents promotion when NUMA_BALANCING_MEMORY_TIERING is >> disabled and the folio is on the lower tier. >> >> Behavior before this change: >> ============================ >> - If NUMA_BALANCING_NORMAL is enabled, migration occurs between >> nodes within the same memory tier, and promotion from lower >> tier to higher tier may also happen. >> >> - If NUMA_BALANCING_MEMORY_TIERING is enabled, promotion from >> lower tier to higher tier nodes is allowed. >> >> Behavior after this change: >> =========================== >> - If NUMA_BALANCING_NORMAL is enabled, migration will occur only >> between nodes within the same memory tier. >> >> - If NUMA_BALANCING_MEMORY_TIERING is enabled, promotion from lower >> tier to higher tier nodes will be allowed. >> >> - If both NUMA_BALANCING_MEMORY_TIERING and NUMA_BALANCING_NORMAL are >> enabled, both migration (same tier) and promotion (cross tier) are >> allowed. > > There was no feedback on this, nor on your v1. > >> Fixes: 33024536bafd ("memory tiering: hot page selection with hint page fault latency") > > Ying Huang seems to have moved around a bit - let me add a couple more > email addresses. Apologies if we have multiple Ying Huangs! Thanks! I don't find other Ying Huang in mm community yet. Now I use the following email address: "Huang, Ying" Ying Huang and stop using the following email address: ying.huang@intel.com > Rik, Mel? It's a bugfix. > > Thanks. > > > > From: Donet Tom > Subject: memory tiering: do not allow promotion if NUMA_BALANCING_MEMORY_TIERING is disabled > Date: Mon, 23 Mar 2026 04:48:49 -0500 > > In the current implementation, if NUMA_BALANCING_MEMORY_TIERING is > disabled and the pages are on the lower tier, the pages may still be > promoted. > > This happens because task_numa_work() updates the last_cpupid field to > record the last access time only when NUMA_BALANCING_MEMORY_TIERING is > enabled and the folio is on the lower tier. If > NUMA_BALANCING_MEMORY_TIERING is disabled, the last_cpupid field can > retains a valid last CPU id. > > In should_numa_migrate_memory(), the decision checks whether > NUMA_BALANCING_MEMORY_TIERING is disabled, the folio is on the lower tier, > and last_cpupid is invalid. However, the last_cpupid can be valid when > NUMA_BALANCING_MEMORY_TIERING is disabled, the condition evaluates to > false and migration is allowed. > > This patch prevents promotion when NUMA_BALANCING_MEMORY_TIERING is > disabled and the folio is on the lower tier. > > Behavior before this change: > ============================ > - If NUMA_BALANCING_NORMAL is enabled, migration occurs between > nodes within the same memory tier, and promotion from lower > tier to higher tier may also happen. > > - If NUMA_BALANCING_MEMORY_TIERING is enabled, promotion from > lower tier to higher tier nodes is allowed. > > Behavior after this change: > =========================== > - If NUMA_BALANCING_NORMAL is enabled, migration will occur only > between nodes within the same memory tier. > > - If NUMA_BALANCING_MEMORY_TIERING is enabled, promotion from lower > tier to higher tier nodes will be allowed. > > - If both NUMA_BALANCING_MEMORY_TIERING and NUMA_BALANCING_NORMAL are > enabled, both migration (same tier) and promotion (cross tier) are > allowed. > > Link: https://lkml.kernel.org/r/20260323094849.3903-1-donettom@linux.ibm.com > Fixes: 33024536bafd ("memory tiering: hot page selection with hint page fault latency") > Signed-off-by: Donet Tom > Cc: Baolin Wang > Cc: Ben Segall > Cc: David Hildenbrand > Cc: Dietmar Eggemann > Cc: "Huang, Ying" > Cc: Ingo Molnar > Cc: Juri Lelli > Cc: Mel Gorman > Cc: Peter Zijlstra > Cc: "Ritesh Harjani (IBM)" > Cc: Steven Rostedt > Cc: Valentin Schneider > Cc: Vincent Guittot > Signed-off-by: Andrew Morton > --- > > kernel/sched/fair.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > --- a/kernel/sched/fair.c~memory-tiering-do-not-allow-promotion-if-numa_balancing_memory_tiering-is-disabled > +++ a/kernel/sched/fair.c > @@ -2024,8 +2024,12 @@ bool should_numa_migrate_memory(struct t > this_cpupid = cpu_pid_to_cpupid(dst_cpu, current->pid); > last_cpupid = folio_xchg_last_cpupid(folio, this_cpupid); > > + /* > + * Do not allow promotion if NUMA_BALANCING_MEMORY_TIERING is disabled > + * and the pages are on the lower tier. > + */ > if (!(sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) && > - !node_is_toptier(src_nid) && !cpupid_valid(last_cpupid)) > + !node_is_toptier(src_nid)) > return false; > > /* > _ --- Best Regards, Huang, Ying