From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (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 A33102BCF5D for ; Wed, 18 Mar 2026 21:02:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773867728; cv=none; b=quNu87aAAwZxWFGywSBNdV13NgxVOJprPOFgM1Sjh5xQ18zZKfmDwJFgA2gGEL2i2ZAWTaHlNihBF2a1PUfspbwWsXc0EUVPad9vHkrz9y9wdwy24KC8Hg5xBSi6biA+uyo4q8CMZzCQIs5U7QP3iXClnW+QqNHAVMif3uIz3Kw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773867728; c=relaxed/simple; bh=g3p9Tjp2vn+M7hP4iyyS0+x9pGTVfPuwd6FvO3khfiE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ajqZBeoPhTqJwbjkiiXlSaaq2MAGTF8BzT5m1Wr/wZFsb0DyzN6ZNDeqq0roNLrtgsakXGb4P4LhZ5T3EZBBDMBLPc1HZJKd2gd72/dw0y/+RkaGfxF081cP25n801TlyS7sV9PBLOAbCiJ/ZM9sXtbxJDlRUG7h/oK/XasD4Cc= 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=A+EOEniy; arc=none smtp.client-ip=91.218.175.181 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="A+EOEniy" Date: Wed, 18 Mar 2026 14:01:59 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1773867724; 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: in-reply-to:in-reply-to:references:references; bh=+gPDPE3uP04XSuNdZbsheC2vtbIrc4cqcngmTQFNGy0=; b=A+EOEniyWQYhVl61shViOBJbhpEB+/bVhL09lUHRy4w2KAytPlP17s1k1J02xZwSxZA/8Q GurPFTE5HsA77/+1QbOb/rFmQPY1Pcg1wNES1HRi5Q7zA/Yt+ghc68alknlCEya6uYGxQ2 5+NAHszXSoSn5V9GnVX6tIHSGIJ8Cv0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Johannes Weiner Cc: Andrew Morton , David Hildenbrand , Yosry Ahmed , Zi Yan , "Liam R. Howlett" , Usama Arif , Kiryl Shutsemau , Dave Chinner , Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 6/7] mm: list_lru: introduce folio_memcg_list_lru_alloc() Message-ID: References: <20260318200352.1039011-1-hannes@cmpxchg.org> <20260318200352.1039011-7-hannes@cmpxchg.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: <20260318200352.1039011-7-hannes@cmpxchg.org> X-Migadu-Flow: FLOW_OUT On Wed, Mar 18, 2026 at 03:53:24PM -0400, Johannes Weiner wrote: > memcg_list_lru_alloc() is called every time an object that may end up > on the list_lru is created. It needs to quickly check if the list_lru > heads for the memcg already exist, and allocate them when they don't. > > Doing this with folio objects is tricky: folio_memcg() is not stable > and requires either RCU protection or pinning the cgroup. But it's > desirable to make the existence check lightweight under RCU, and only > pin the memcg when we need to allocate list_lru heads and may block. > > In preparation for switching the THP shrinker to list_lru, add a > helper function for allocating list_lru heads coming from a folio. > > Reviewed-by: David Hildenbrand (Arm) > Signed-off-by: Johannes Weiner Acked-by: Shakeel Butt