From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) (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 50D9448CD40; Mon, 7 Sep 2026 11:01:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788778885; cv=none; b=fNrlduTDS+Rn8tl0g+/3BrqpBJLfnUJEOcyZE20GNXJyia/wybw1Th9IPW+BCBeiCPtUpVy9EfeaEhOu53jnYfEl7sNiA9nCB5fMwfFJNCH3Jo/j+vFQJ17n1Yn1G05OAO0wjj7fh9Hi8AqRhmG7la5Yuw0fa321iZRKSUF0BzU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788778885; c=relaxed/simple; bh=6ec5OpU3JoMvKMwc66OsCsaRbuZsMKGll5y1quzBcog=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FUPjd8jAfQWBocZ19N+BfVoU0FVOOQMM6khyzWdulEDiS5GVcv+cq73rrYZ81rOk78DFDwM5Ke41DbuWOJRdnUNTFNu03lK2QahUU9TihYxVPLgkRNGmWRXY5nZAPtAzB8fq12hLuuq6uTZ28MAGJVq7LLAM2aRzonogOEA+idE= 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=ufLa2YZ7; arc=none smtp.client-ip=115.124.30.101 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="ufLa2YZ7" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1788778881; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; bh=cmWYNJGIXxazgZ5q5HpJHBhK6Ac8N304N8jTgUaL0cU=; b=ufLa2YZ7Va6TgXA4VKxj1Yvnk9V0zZmF0Wrtd4Ysr9qH5kWh1VCWS50KEjw1Vlv4sWzV43y4/gcOH0Jqfn+HjAiwLGSHVW0s0NxcT+quvL66X4p9sclfJYvu27/+OuhJDncxVrohPqKgzTjwkwUMf7OzWghIutEyHJC12ZbflD8= 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-contentspam033037026112;MF=qinyuntan@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0XATsw.3_1788778878; Received: from banye.tbsite.net(mailfrom:qinyuntan@linux.alibaba.com fp:SMTPD_---0XATsw.3_1788778878 cluster:ay36) by smtp.aliyun-inc.com; Mon, 07 Sep 2026 19:01:19 +0800 From: Qinyun Tan To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , =?UTF-8?q?Michal=20Koutn=C3=BD?= , David Hildenbrand , Zi Yan , Baolin Wang , Usama Arif , Dave Chinner , Qi Zheng , Yosry Ahmed , Nhat Pham , Chengming Zhou , Xunlei Pang , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qinyun Tan Subject: [PATCH v2 3/4] mm: thp: restore SHRINKER_NONSLAB on the deferred split shrinker Date: Mon, 7 Sep 2026 19:01:10 +0800 Message-ID: <20260907110111.2286932-4-qinyuntan@linux.alibaba.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20260907110111.2286932-1-qinyuntan@linux.alibaba.com> References: <20260907110111.2286932-1-qinyuntan@linux.alibaba.com> Precedence: bulk X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On a system booted with cgroup.memory=nokmem, the deferred split shrinker is quietly demoted to a non-memcg-aware one. As a result, partially unmapped THPs are only split under global reclaim; memcg (limit-induced) reclaim never splits them, so a cgroup under memory pressure keeps its underused THPs intact. This is a regression from commit fafaeceb89a5 ("mm: switch deferred split shrinker to list_lru"), which re-registered the shrinker without SHRINKER_NONSLAB. The shrinker had carried this flag since commit 0a432dcbeb32 ("mm: shrinker: make shrinker not depend on memcg kmem") precisely so it would keep working with kmem accounting disabled. Without the flag, shrinker_memcg_alloc() fails with -ENOSYS under nokmem and the shrinker loses its memcg awareness. This was noticed by Michal during review of the patch "mm/list_lru: don't copy stale shrinker id from non-memcg-aware shrinkers" [1]. Restore the flag. [1] https://lore.kernel.org/lkml/697713c4-0857-485b-aba7-c74f37a3c8b4@linux.alibaba.com/ Fixes: fafaeceb89a5 ("mm: switch deferred split shrinker to list_lru") Suggested-by: Michal Koutný Signed-off-by: Qinyun Tan Acked-by: Zi Yan Acked-by: David Hildenbrand (Arm) Acked-by: Usama Arif Reviewed-by: Baolin Wang --- mm/huge_memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index c5d11147b69ae..87c9fc48b7cfd 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1064,7 +1064,8 @@ int folio_memcg_alloc_deferred(struct folio *folio) static int __init thp_shrinker_init(void) { deferred_split_shrinker = shrinker_alloc(SHRINKER_NUMA_AWARE | - SHRINKER_MEMCG_AWARE, + SHRINKER_MEMCG_AWARE | + SHRINKER_NONSLAB, "thp-deferred_split"); if (!deferred_split_shrinker) return -ENOMEM; -- 2.43.7