From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD7C13A1E8B for ; Mon, 22 Dec 2025 06:16:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766384179; cv=none; b=umlJh3bDHIxNtJewNeatokDjnuMXLqTpFgJGHWODRicYQBKs8WXkDPVzBQLdQY5Nu97FALdYGl8PMKNaU95xzZbKEH2u9r0aalafjk1UQWQ8CWOLU16naqWLhP7yuqdO3QfMqxvlt622pgxylEpR8O4PSJI/EkjGuvC6brMlDyA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766384179; c=relaxed/simple; bh=qJppBJsOhFIxTOsK1hS7LDo+QmNejh8ZeARb+OCK24c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=As53/0cDcwWqwWaoxGyUrwyjEKe5AxzQIIcXA0GhMG6S7I2/vdaFvEcK3dW5xdvesKQNGn0LhucITBlW/FKr+xoHuwnTpdN3YXilYLHv6ZTkmSh/NWA2wAGfkGXPfu9wXWfz4pI1fZHN6rqaS/rrIJP84Kc5GX8L8RFg0pTxCFE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uzcukW13; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uzcukW13" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2a1462573caso462165ad.0 for ; Sun, 21 Dec 2025 22:16:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766384177; x=1766988977; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=sKlYwDKHeLnktmF0WJtLvL/mlQQWgFKsDt5lGymxEgs=; b=uzcukW13mDPkoHELudtX0Gsn7hTL6pL6Bj7DEOLZk7Cqz/raQ0+n1zA1TgjBB4Hus1 I2CunPoUritJ/5tcnezRmZ5EedK8eWLGXRsbRdHtH/C0rC5Yv5nf8/YqgeO4/SCJPhex SE1/lxyDsBXmgmRFBzzc4RVkLXWkGXQHZU4ddQU/PbTLKA/gAKT4Gl2LJGIlN1MrfJiA DNSb+yL/U+C/b0ZelLgiZsBDih1iaiPVFKyBzTvulMMTQ/tnfkTrX+H+8UR7k4QqYiQM MXRfA1ZZB/1spOKpWhUAjviv8gxab/i3q7rpZ9bHn84eDQIlwc0n8J308U6iySa9nLDl 9sZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766384177; x=1766988977; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sKlYwDKHeLnktmF0WJtLvL/mlQQWgFKsDt5lGymxEgs=; b=KWJWxmpX7l4WWmIiHizo0VuN2Ti7dLMiAHGabk0xqpNKB4+7R89IDJKBLLfATJykfD 3QhckgcHr1JEqPlyiV+A/mhR98rHjz+SP91vkZIzs2zU7M4pWBVEBt8PeT0po5exwqaK RL/FqA+X8F5DPRUtutHY2ICQ7hK3cY0fbEbTroonS1raiMRowtXqf75/qp4Y9+i70RE4 jNBpue3VeJsnaU83F5MnxhFpUnce+L1xj6ZjJEqw2iukTWPxmcT7xX0LEeZL50mQqAq+ eojRy6xAsh80KGMwPnvTHYjm6HM1b+tLJejAbB4eAtY5p5p+tJ5jEg5R4N2YZTq9exK6 8tRg== X-Forwarded-Encrypted: i=1; AJvYcCXFkPU9uiyXoNaReOeJi5u4BGfTtLLF/vfGZCIStz5w3RZEPw5N6qEgDFkXqPUzfbHrZZEf+YbuuPSyHGo=@vger.kernel.org X-Gm-Message-State: AOJu0Ywio1rioiEBAL1J9I6O2CRewGILtyit0WbnSRra1ooV1tvAi5EW 7qnxS1Xpzm8WFSPBxbSvA7Pml1EI4LEbxBXLn8Q3nuWvKyULRCw9o2NKFjOVOetkBQ== X-Gm-Gg: AY/fxX7qBKSbjwLnhLRdcCFhY2gbclYBloA+SpQXgltHfWn21nUA9clLTuBY8hZNanP gOllZ65xqt5WGRCa8ZIctdJ4i55tpVH8svzKk5uzNU6TBGRtH9KbN2xVv/AseegwJAOy/FHQK3+ 7dd9luRBgeTygMOYNHi8KRdkq80vCiDOMhFoCH1iHObbm5vttWGDudPQWDfBfgmQhGrZ7tNCIJG hqRsWHixJjbVOajvoRwNWn/EXV2V+8M8S3KuOw0rODN5ePaePlmigCwXT8D5gMxvGFCuMIHpqnD nKSfkYP6eJ3gIX1pL3x5Ot/NlmJZGuwoqfnQOQOoQAWShYYGVFk1/dCy5g73aVQboF9YLtH0ZfI fwVqFqmDwTid6QipKWIbRhH6OEO8MCZTOl0lsA0R+cyUo0r2NUbTF4iRkgRS9/K3uE0jxkHdaTO lil2sGkx4nbLIu1zyjO4yntJBb0UXUZ495JdyO7WusnKHJNctoGxSM X-Google-Smtp-Source: AGHT+IHOweUx0BGgzRR3Uc5xIVtiHnSb9Bezh6rOocQ9AsReM27o8TisrBOm2xsLcgOS2vYsn/Ffgg== X-Received: by 2002:a17:902:ef47:b0:2a1:3cdc:7720 with SMTP id d9443c01a7336-2a3142e92d0mr2719085ad.21.1766384176711; Sun, 21 Dec 2025 22:16:16 -0800 (PST) Received: from google.com (248.132.125.34.bc.googleusercontent.com. [34.125.132.248]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7ff7e48f258sm9029528b3a.47.2025.12.21.22.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Dec 2025 22:16:16 -0800 (PST) Date: Mon, 22 Dec 2025 06:16:10 +0000 From: Bing Jiao To: Andrew Morton Cc: linux-mm@kvack.org, gourry@gourry.net, Waiman Long , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Tejun Heo , Michal =?iso-8859-1?Q?Koutn=FD?= , Qi Zheng , Axel Rasmussen , Yuanchu Xie , Wei Xu , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/vmscan: respect mems_effective in demote_folio_list() Message-ID: References: <20251220061022.2726028-1-bingjiao@google.com> <20251220112044.ee858d2160f819e181598ce1@linux-foundation.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <20251220112044.ee858d2160f819e181598ce1@linux-foundation.org> On Sat, Dec 20, 2025 at 11:20:44AM -0800, Andrew Morton wrote: > On Sat, 20 Dec 2025 06:10:21 +0000 Bing Jiao wrote: > > > Commit 7d709f49babc ("vmscan,cgroup: apply mems_effective to reclaim") > > introduces the cpuset.mems_effective check and applies it to > > can_demote(). > > So we'll want > > Fixes: 7d709f49babc ("vmscan,cgroup: apply mems_effective to reclaim") > > in the changelog. > > > However, it does not apply this check in > > demote_folio_list(), which leads to situations where pages are demoted > > to nodes that are explicitly excluded from the task's cpuset.mems. > > > > To address the issue that demotion targets do not respect > > cpuset.mem_effective in demote_folio_list(), implement a new function > > get_demotion_targets(), which returns a preferred demotion target > > and all allowed (fallback) nodes against mems_effective, > > and update demote_folio_list() and can_demote() accordingly to > > use get_demotion_targets(). > > 7d709f49babc fist appeared in 6.16, so we must decide whether to > backport this fix into -stable kernels, via a Cc: > . > > To make this decision it's best to have a clear understanding of the > userspace visible impact of the bug. Putting pages into improper nodes > is undesirable, but how much does it affect real-world workloads? > Please include in the changelog some words about this to help others > understand why we should backport the fix. > > > Furthermore, update some supporting functions: > > - Add a parameter for next_demotion_node() to return a copy of > > node_demotion[]->preferred, allowing get_demotion_targets() > > to select the next-best node for demotion. > > - Change the parameters for cpuset_node_allowed() and > > mem_cgroup_node_allowed() from nid to nodemask * to allow > > for direct logic-and operations with mems_effective. > > If we do decide to backport the fix into earlier kernels then it's best > to keep the patch as small and as simple as possible. So non-bugfix > changes such as these are best made via a second followup patch which > can be merged via the normal -rc staging process. > Hi Andrew, thank you for the review and suggestions. I hvae sent a patch v2 for the backport. However, I forgot to add the CC:stable line. I will fix it in v3. Best, Bing