From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 912FB36AB50 for ; Wed, 18 Mar 2026 20:57:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773867480; cv=none; b=mXbeLrBI+7E+5V7sTaSnHAmqdaUWLPQHYNZGyF1AgaueSkezL0b6qGQD9ZFUFyTOjGN1KcwJpiIhuaroiDGo6ek9iW2fJARZD6ZsiOTbmH7NFjVMlUiSv3u5v42ajqJKTLnXXRWdcLjrsEn3FwwfLZSgHvE1CMhIzAmRNE4J/BU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773867480; c=relaxed/simple; bh=Oy0njUjW6R5iexNMz3wzKCSxfU2YGWhYv9JL6HRw5xo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=X7b16w/W2tdDKWREWneop6cSkK3X5Lat4vgt5VG2HkqaXndpt9+yDmbF7m0OKf0hwcyxvsGinwGnM7ZhfrKtaZcTBSI2sjVH3WudmOd8VxAweBif+X8ABMrhQ4oMgvHzmmBksWUbqvRAYBDWSVizPEJOHKoltU0jRv3cr5R/PW0= 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=R+E57JVT; arc=none smtp.client-ip=209.85.214.171 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="R+E57JVT" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2aeab6ff148so8305ad.1 for ; Wed, 18 Mar 2026 13:57:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1773867479; x=1774472279; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=Oy0njUjW6R5iexNMz3wzKCSxfU2YGWhYv9JL6HRw5xo=; b=R+E57JVTj11xcfxsQdrauM6zpW8njxl0/iWi6D4LQEOAU2x11nmZq+4ncgRIUF6A2o CxHUYJalJUGS0pXYkREW2wfv4lk9KLfL1er7CCXjLF8iAKLbAsL41dVMY46s5DdRK/+y CqVhgoCl87vvdmxFYWEEdveDU2WHkCv3Ka3lHA6BRkg+twKeulSc1puzECqLsko7bcp+ oPHsndPjIArPwbuHVH7ruYs+MUaquQgy7nRJDy7FiTwwNJFyEYJyYCF8J9/UsXwUc4Qe ski8P9LLcLRNzB2lVw69aTk5A9dVvv+r3VwSD/RWLvy7CwGWaXA4ytR6hidQoyT2WA5k muXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773867479; x=1774472279; h=in-reply-to:content-transfer-encoding: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=Oy0njUjW6R5iexNMz3wzKCSxfU2YGWhYv9JL6HRw5xo=; b=pP5ZJdoS8qCQbTTwTnw3rvsHq/95L9v1hte2u/5Ha6Gn3d1jywXGJyDAQzB+NRGUKh qUth6VVyKhDlpscDI0s4jFE7XMU4XnA/2ykcBUgxHD3f34PPjTNDKuDtKu/sCykEfD6x Dc0fLoNncx1rIKIS0FlSb3F/PpDdcJWpflZqrLMeIvjfpII8W2OD0pgmmjmn8b5plX4S 6Sk9lidvwFfqMas0l4SpsYuQtNU+UI06xF+1jQrGwMW4J6CXzit6c+25LL8OZXXpQhzw /o5Q3OXB70roWyQfe4his4JH6JsajUHsA8Sud/12DOxDwLhRPmV2ZT0hD3oDNf5lUTFs 3L2w== X-Forwarded-Encrypted: i=1; AJvYcCUfpHSV4f6XJHKJ4aWy/4yE2jqCE4IEtoAqUhm+Eg7nPtyofkYNBFjrGEEwIiAPIRTVby/JuZwap7OrHSc=@vger.kernel.org X-Gm-Message-State: AOJu0Yz21geuEBuJMvJ9N/JdhvvY8Rlx3PZCGWBpwOECq8btv0DS/v2Z MXadV9pKNGAzFKBoZIq3V1JPNWOGbUq9BzI02jC7oqSyVj5q23NY26We/n77uE8Jmw== X-Gm-Gg: ATEYQzzJUC6gXV80rGzjZ9axYQhXSHfmhf2gyq8rtMZGfJDTynmc0pwERy8hlO+7hk5 PLZlpSCo8wLbhEnNvIvgewV46e9u7PI6jGR4en7QYgMqdZf/dMUN4hdYqy2p/loabOuFZTFregw nqZiGAhy9odIPt19WAJ+X4B+fOmp42ytiE8RsVJ1eaVxUGrQgxAaUcqHFnTfSBeQYX1llx4WavH Ve+YhByrOgTB+VXaf7ge6yN4nErPYO4/sxrA3k0SSjw2zcaK/CJdA6TkeJZeLOxKZbZTtXUNCor wfQTh1UXHI/Nnap0mjlagmNyZ4vtoMZAgfbHVvJ+Z6OPk3iC8Q07rkiwt+3+l6AdUu5PZH1B10X 1NnjPdaqCjqSnrPoTwrFHvlP61G9ITO0nTIxPmVP2HfnRXw0VHwfCKPGamd+UJzdGIBQRvZHFk/ imV7tU8pLd7dJkbiY4qo09xZaXydt4Sk4Jrv6PxmAZYlKmVIH9KRFB5e4iG6H0Jk9vZaRaB26zV Uk= X-Received: by 2002:a17:902:d549:b0:2b0:5ba3:2416 with SMTP id d9443c01a7336-2b079f9f6d5mr203135ad.7.1773867478553; Wed, 18 Mar 2026 13:57:58 -0700 (PDT) Received: from google.com (206.238.125.34.bc.googleusercontent.com. [34.125.238.206]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35bbad77e50sm1525460a91.6.2026.03.18.13.57.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 13:57:57 -0700 (PDT) Date: Wed, 18 Mar 2026 20:57:51 +0000 From: Bing Jiao To: Yosry Ahmed Cc: linux-mm@kvack.org, Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , David Rientjes , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Youngjun Park , David Hildenbrand , Qi Zheng , Lorenzo Stoakes , Axel Rasmussen , Yuanchu Xie , Wei Xu , Joshua Hahn Subject: Re: [PATCH 2/3] mm/memcontrol: disable demotion in memcg direct reclaim Message-ID: References: <20260317230720.990329-1-bingjiao@google.com> <20260317230720.990329-3-bingjiao@google.com> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Mar 17, 2026 at 04:44:34PM -0700, Yosry Ahmed wrote: > On Tue, Mar 17, 2026 at 4:07 PM Bing Jiao wrote: > > > > NUMA demotion counts towards reclaim targets in shrink_folio_list(), but > > it does not reduce the total memory usage of a memcg. In memcg direct > > reclaim paths (e.g., charge-triggered or manual limit writes), where > > demotion is allowed, this leads to "fake progress" where the reclaim > > loop concludes it has satisfied the memory request without actually > > reducing the cgroup's charge. > > > > This could result in inefficient reclaim loops, CPU waste, moving all > > pages to far-tier nodes, and potentially premature OOM kills when the > > cgroup is under memory pressure but demotion is still possible. > > > > Introduce the MEMCG_RECLAIM_NO_DEMOTION flag to disable demotion in > > these memcg-specific reclaim paths. This ensures that reclaim > > progress is only counted when memory is actually freed or swapped out. > > See the discussion @ > https://lore.kernel.org/linux-mm/20250909012141.1467-1-cuishw@inspur.com/ > and the commits/threads it is referring to. Hi Yosry, Thanks for pointing it out! I was unaware of the previous discussion regarding demotion as aging progress. I will drop patches 2 and 3 from this series and resubmit patch 1 as a standalone fix by replying to this thread. Thanks, Bing