From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) (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 043EF224AFA for ; Thu, 6 Aug 2026 06:11:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785996698; cv=none; b=IPesE0ySoOL0+Ch1upJBOXpdm7uS9SA3GLbbGBk1HniWDPM2y9SHhVm5L+voOaUHV8I5wGFJIX7ePGLBT+mk8I8iMpBeeW9V3xNxAuasCMGSKI2VHhRUyZ7fdhdZtNlsJhK9iH6KCD+Unj8Fb6sPe+gES3vrAKK7QVN1VSxTpjs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785996698; c=relaxed/simple; bh=fQ3V5Od2wXEn+kEQkjn43+q/TijLVhphSRsDMr48zbM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=FkUXnBtiiPwSX8t4YxnQgEvQh/GSZXfPKF7E/yuUOco/jKaJfk090eHYX6WPLm626QiEdUBboGExb6IZy3bYGs+P9D4PF4TRm6KqfMw4AMHVAqJP5pUdOSzj9/WECT+xTaZTiOxSNTqkBKE/eh7bB0OmJVVf4R/kftE3271zbCM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ogVYJXWe; arc=none smtp.client-ip=95.215.58.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ogVYJXWe" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785996690; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=spjt2LGro3JS15s3N7M9+Pb2c/mW7vROd7KAq9Evaos=; b=ogVYJXWeGuywvulCTTKvO0yL/jbby+d4T8lwtAKgYkxCQFNJxo9uXuehFKLqztDJF5RTvZ 5VwSxb6YQJfLIMAsnsKqzyeHCTm42iZQZqL0Ht6QB6wCH2RJyTPp24swpb/tFKJfRPe8kU wAcXfOnupXdSc/qlUuWBg1a+WQT5OS4= Date: Thu, 6 Aug 2026 14:10:58 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v3 3/3] mm: shmem: make unused huge shrinker memcg aware To: Baolin Wang , hughd@google.com, usama.arif@linux.dev, brauner@kernel.org, akpm@linux-foundation.org, david@kernel.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng References: X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Qi Zheng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 8/6/26 1:35 PM, Baolin Wang wrote: > > > On 8/3/26 4:46 PM, Qi Zheng wrote: >> From: Qi Zheng >> >> The shmem unused huge shrinker keeps a per-superblock list of inodes >> whose >> tail huge folio extends beyond i_size. Since that list is not memcg >> aware, >> reclaim triggered by one memcg can scan inodes from the whole superblock >> and split shmem huge folios charged to unrelated memcgs. >> >> Convert the shrink list to a memcg-aware list_lru. Queue each inode on >> the >> list_lru sublist matching the memcg and node of the current tail huge >> folio, so non-root memcg reclaim only walks candidates charged to the >> reclaiming memcg. Global reclaim, root memcg reclaim and shmem quota >> reclaim keep global semantics. >> >> The list_lru still tracks inodes while the actual split target is the >> current tail huge folio, so validate the folio memcg/node during scan. If >> the folio no longer matches the reclaim context or splitting cannot >> proceed, requeue the inode according to the current tail folio; if the >> inode is no longer shrinkable, drop the scan entry. >> >> This can be tested with the shrinker debugfs interface by allocating 32 >> tmpfs tail THPs in each of two memcgs, then scanning the sb-tmpfs >> shrinker >> with memcg A's cgroup id: >> >>                 before A scan    after A scan >>    base         A=64M, B=64M     A=64M, B=64M (per-memcg count is >> skipped) >>    patched      A=64M, B=64M     A=0,   B=64M >> >> Signed-off-by: Qi Zheng >> --- > > Apart from the two issues Sashiko pointed out (which you've already > replied to), nothing else jumped out at me. Thanks. Thanks for the review! I will fix those two issues as I replied, and then send out v4.