From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.171]) (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 C80C436B07C for ; Wed, 18 Mar 2026 20:52:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773867149; cv=none; b=D0oG7MbKP/SPqyK6n/Z/9rcb5A3RRhK0SCXtrUuB7AKjo42NrKrEnDnM7cvNnhicJCEe8A7vLLpr8+DD1XkyFee/Tbxaco3tCY8dsuUrCirA4JmrszxtZfhADLRTldXqPIDbIibl1RxI0RaTbwExfO5lWOkS5kOt+M739tqDEoY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773867149; 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=TjP1yIZ9wns2U+CCQJKBsRaHQHE4OqsgEBG43fVbFu90iZZap90LFMiK4uj/FMN86ydjh0ALuqyUxKfDQK6ZbQie/cYZoeHbXhxiGuNsx86U55z+I1dgE9IkARo6bnaGAFWoRFOaPuw6PUDijzzIS7uOe7hBoGffI+VilkivnIo= 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=Xk4BVuw5; arc=none smtp.client-ip=95.215.58.171 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="Xk4BVuw5" Date: Wed, 18 Mar 2026 13:52:11 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1773867145; 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=Xk4BVuw5VIILLUcfGzi5lYXa16hNfK+fwd+kKGACgtY5nNJBPU/NiOpJFamI0qLlmbFX4f hAxYY9XURLXXeCg3UYG6U39iMNfGVI2LB146cmmbfgeOZSrLouhxmIW5rPOnrcY7mYaCdP DtyVcTzJNqHCMQV8ailmf6tk2REKI7A= 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