From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2F1753E63AF for ; Tue, 24 Mar 2026 11:36:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774352217; cv=none; b=bT5vjyqoPvXcsUVGp1Zo6/1vAOrlmeg+7krIBqovYYIy0uvOLDytvxDKRKsop/jcZKyEsng5vTs79ketcBcmmSfYiXilziESurkPdBbaXdMLKvR9+nGP/8g74bLcvHomDpZHoj0tmJdEbJoIkv8zyTnbhLN8kst6KdgMbOyVqnQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774352217; c=relaxed/simple; bh=tQSs2dFj+n0DSQeut8yGh2rxuLxtozxe3F5h1kJgfvk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SqyHHljtqytmzEnur5O04dGgMpfF2TSfQMxUPmfPHRlisKy2yfEod81twa658yt/+DLDn2hTwfi1GAlWwg0O/8lJWme/HramKcjBjRvKu2h9o5sk+pMKviEcYdSXO4RMkemN6RVJYu8/cPKblherpfOidlw/HxLlE6qzRbizGKA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MtaRfCQ3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MtaRfCQ3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FBDFC2BCB1; Tue, 24 Mar 2026 11:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774352216; bh=tQSs2dFj+n0DSQeut8yGh2rxuLxtozxe3F5h1kJgfvk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MtaRfCQ3ZhLZQfIdmx3CXjhspsFtT1KkpoqNxB+3xRp8wEzWFbYb8f1EzJSEuEUIA DSKxggnRw+0t5IUUZfSlc73fLUjz8fXwmbpQ5hf1Vo5NE0dn7Roq0beFTQpJbD5jPE L4dp5uG2/m1G7vBbJaL3IzY5+EOgc/eWjrdA/KdmmLYazxliW0CdIarikJ39sOka2U nDZ7tBq/8slZ7D2PO+pktaIrbePjvbp831kg/LUSOmacyPfjgEcliRYlfkPQIQ06wE Md7XD7K1i60zeqrShWzuHGFn2AGRxM4cUsjlzI4NHpTdlVpt9I24KD0VYGjV/YX5l7 0gMS/pPpz7HtA== Date: Tue, 24 Mar 2026 11:36:54 +0000 From: "Lorenzo Stoakes (Oracle)" To: Johannes Weiner Cc: Andrew Morton , David Hildenbrand , Shakeel Butt , 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 4/7] mm: list_lru: deduplicate lock_list_lru() Message-ID: <666b8dab-a58e-4cc0-aafd-57fd59477068@lucifer.local> References: <20260318200352.1039011-1-hannes@cmpxchg.org> <20260318200352.1039011-5-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-5-hannes@cmpxchg.org> On Wed, Mar 18, 2026 at 03:53:22PM -0400, Johannes Weiner wrote: > The MEMCG and !MEMCG paths have the same pattern. Share the code. > > Reviewed-by: David Hildenbrand (Arm) > Signed-off-by: Johannes Weiner I like the symmetry also here :) LGTM, so: Reviewed-by: Lorenzo Stoakes (Oracle) > --- > mm/list_lru.c | 21 +++++++++------------ > 1 file changed, 9 insertions(+), 12 deletions(-) > > diff --git a/mm/list_lru.c b/mm/list_lru.c > index 1a39ff490643..4d74c2e9c2a5 100644 > --- a/mm/list_lru.c > +++ b/mm/list_lru.c > @@ -15,6 +15,14 @@ > #include "slab.h" > #include "internal.h" > > +static inline void lock_list_lru(struct list_lru_one *l, bool irq) > +{ > + if (irq) > + spin_lock_irq(&l->lock); > + else > + spin_lock(&l->lock); > +} > + > static inline void unlock_list_lru(struct list_lru_one *l, bool irq_off) > { > if (irq_off) > @@ -68,14 +76,6 @@ list_lru_from_memcg_idx(struct list_lru *lru, int nid, int idx) > return &lru->node[nid].lru; > } > > -static inline void lock_list_lru(struct list_lru_one *l, bool irq) > -{ > - if (irq) > - spin_lock_irq(&l->lock); > - else > - spin_lock(&l->lock); > -} > - > static inline struct list_lru_one * > lock_list_lru_of_memcg(struct list_lru *lru, int nid, struct mem_cgroup *memcg, > bool irq, bool skip_empty) > @@ -136,10 +136,7 @@ lock_list_lru_of_memcg(struct list_lru *lru, int nid, struct mem_cgroup *memcg, > { > struct list_lru_one *l = &lru->node[nid].lru; > > - if (irq) > - spin_lock_irq(&l->lock); > - else > - spin_lock(&l->lock); > + lock_list_lru(l, irq); > > return l; > } > -- > 2.53.0 >