From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 3307D1D8E01 for ; Sat, 21 Mar 2026 04:04:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774065895; cv=none; b=qonIxfawBc6J28Mjpxjw3Uldzkk98eU59c2hWwkUAnwyU8cg3R5ogUElIVfe5F4m3HExH1RDrJ6bcJ4znJ49BcUGqIuBI8U7/pkkanVompQXLpiHHYjDg2yIWOxXvbHOoa3JvOeAtzsSH9cAX43jJJmjaEHG4tsrIlL7z0CAL3s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774065895; c=relaxed/simple; bh=Vb0hgyyRQxiEoRD57QPoNnifO28j8YAw05wFPmEsgvQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UAF1RusqtCpOUvUtZUN5d/HhXESDxMNMAKnUIrhPklfiXy4q5k8w3sKIe7H/J9Gc2eCQYH/Do7E1UgSJstJd/h0rI8di18zHk/t2qESam847h4KPEI/+PXvDys38jh4mVkt0BguVUipsyCfuDnqKZcgvozdj2DKzIzw28ZVEv/U= 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=eMWwq7tA; arc=none smtp.client-ip=209.85.214.179 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="eMWwq7tA" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2b052ec7176so36125ad.1 for ; Fri, 20 Mar 2026 21:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1774065893; x=1774670693; 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=Vb0hgyyRQxiEoRD57QPoNnifO28j8YAw05wFPmEsgvQ=; b=eMWwq7tATjetERtfSIF+fUO4VC9GJYpUP8A9Z5JeO4t2OFY5u91IL8YCR44iXM9wo5 Me2n56vNuYSI0al58qlNXVwkeoSxermFyv1ibcNqnIldErprGg2kzVseq332FJLq2TgR HA8klWkQn6+pouGR4pVly9mMe/jAgCj8Zrr+LFOjfy7SW1RceV2vh+8neuVMBEERMzim 6aZB2XjHyYuTfN0Nwq/8D7SqBoAzbl2mQqpVIqPAeVPRQUeUA2bQ8HzO1kScTEW7bs16 jEviwJpAtKyIVLNKG83G9io8OPhZydrJlAx0osBkSCzLEJ8ogBiy2MmbBuK0PbdbrNRt R67A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774065893; x=1774670693; 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=Vb0hgyyRQxiEoRD57QPoNnifO28j8YAw05wFPmEsgvQ=; b=atuzfvoAqTUl9kGlXeVrkXH2p+5xCpF4DYWVD1mD00tMdwRF2Lmw4qbs1lW0J7y+RB m+TmUZ1ZYuOdMXYvyzdWI99jbJ2alWX32SyxYeM99OGwX6nE36a/t2b0jfaPpR9desSY 3viwnRv39hX8rROf19Jmd3SwZTB6YirFEYlOhQBKhPNPlsqfMMOb5vg2gL8z1RU3z1LN UimElSZbMdJy91c7DxRGY6zVL/6ICyA6tiBdpnRN4NEYo3xNFiZ9cg0tq3g3NtvHS7WB vxfQum/hQHJm/5qZWC7ssnHsznKFw9twogoU2EGvrDjw6atLuW7pWm/Dp+N7GjxGfFwI e9sw== X-Forwarded-Encrypted: i=1; AJvYcCUEgieeIbp8C7vDSBZXkefv9fA7DDvn/e43BfdZas9EoAgmEnsdZRc/YBx0lVowOMhJmQzTKlc7sl/bUV4=@vger.kernel.org X-Gm-Message-State: AOJu0YyHgbPXZ4D31+v0Hr39TNYisIMgv5+6CpQVKr7oudFIxZwYMD8w s1IGeb/emNY4s5dEThCkaGNdzduF3AkX1oOAHXIsQz5oWCqgLqbTTol/oaqn/Bzt5A== X-Gm-Gg: ATEYQzwK7CgGcbAR6A+86VN+eU5XKZttRF3tVmS9mjQU3ouHm43LIBOe2YFOPT8tMVH pQtokoKTUazG58oIqv9yKdx374D1LqnI8GsY+t0OmO6gT1q3fDBjDvFsnIhyIOnenwEUijzsFxu 3JCPKxtdrx2V5ss0rMM//XnTspnSDPFCCu5s3RC4DNrTmA4K7MuEJlZtTmiXBjhjC1i1j0xIjRo JMDZtTvZFK+wrQJZAd1keGO7M/RccVW0vB3Mm1p7BOmvuZcakNmx6KxGPO96OrfzVwCv3Pgf01W E8pN3u4Pi0paS/YbTJy9wla6LQnoHQvGLyYnby47B4dvIx20ZI2oIFRfr29izDxLef/oT3tB4qx 3Q26WUXUVZdEjJvcLp7rpO2fypHV75azrXc43DJRqxdMq5ly0KiY8RbTidCY39EXMS9gf48f6V+ pz7gUIrsHcVryXv+1i/K/cP/5o4nmrrl3ozgfxlmhcixd//lWliZsR02kZ8d3+4bl0 X-Received: by 2002:a17:902:ebc5:b0:2ae:7fa2:6bda with SMTP id d9443c01a7336-2b08c38a9b3mr1002905ad.1.1774065892911; Fri, 20 Mar 2026 21:04:52 -0700 (PDT) Received: from google.com (206.238.125.34.bc.googleusercontent.com. [34.125.238.206]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82b0409f582sm3411460b3a.33.2026.03.20.21.04.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2026 21:04:52 -0700 (PDT) Date: Sat, 21 Mar 2026 04:04:47 +0000 From: Bing Jiao To: Donet Tom Cc: linux-mm@kvack.org, Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , David Rientjes , Yosry Ahmed , 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> <380c52cb-fc8d-4fbe-8d2a-f153bd179816@linux.ibm.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=us-ascii Content-Disposition: inline In-Reply-To: <380c52cb-fc8d-4fbe-8d2a-f153bd179816@linux.ibm.com> On Fri, Mar 20, 2026 at 06:47:14PM +0530, Donet Tom wrote: > Hi Bing > > On 3/18/26 4:37 AM, 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. Hi, Donet, Thank you for the feedback and reviewing the patch. > Thanks for the patch. With this change, are we completely disabling memory > tiering in memcg? Yes, this change will completely disable demotion from memcg directly reclaim, as demotion does not help to reduce memory usage. > > Did you run any performance benchmarks with this patch? > > > This patch looks good to me. Feel free to add > > Reviewed by: Donet Tom Thanks again for the review! Following a discussion with Yosry regarding demotion as an aging process, I have decided to drop patches 2 and 3 from this series for now. Additionally, Joshua Hahn's RFC ('Make memcg limits tier-aware') [1] introduces a mechanism to scale memcg limits based on the ratio of top-tier to total memory. This approach or similar approaches might provide a more comprehensive way to resolve 'fake progress' in memcg direct reclaim or establish a better framework for addressing such issues in the future. Hope you have great weekend! Best regards, Bing [1] https://lore.kernel.org/linux-mm/20260223223830.586018-1-joshua.hahnjy@gmail.com/