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 251743630A4 for ; Tue, 24 Mar 2026 11:32:08 +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=1774351929; cv=none; b=IHUaSAf9Hv2Va0wcx7k9vYkDd7aTefzxvs6309hXXR7MmjIgrGzS7jbgQVnNFTezhDOeFm8yNUCtcYkxzm+uYzqKkDIZNtM9LRJZsE8JHI+TgUFdlgsNzuI+Ky3M4aQ3YWrfpgAyGu3s2DNhCgrTm2dADByNsjciNNBo3Xk4GLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774351929; c=relaxed/simple; bh=ghTkbaISTVGwDGdA3ofgsDMiPDJsD2fR76jePcCVtn8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=O0A5QQ/sUSzlgUXHvzAbFYDZKIwwTfSNtw0vWaRMEzbLqME16jN2gJ/uJ1jNyKi07IGAj45DY7jQH3rWvbt2y3NpMefWqGJdvyvzgwBEGKMTNuYF88HG/OJT/rcnB1X3kllzmeDyt8uagyeWIBqQSla2PGwoca+yQ8k8bk2Kfjw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gdTQywvJ; 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="gdTQywvJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EAC1C19424; Tue, 24 Mar 2026 11:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774351928; bh=ghTkbaISTVGwDGdA3ofgsDMiPDJsD2fR76jePcCVtn8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gdTQywvJUHqTM8SHvK9LND9LZNAyWA3XHuGnsBBPewALH0XwY7l7m1Dh9G09BBe0r YpNDsa8WvrZx2731jLLyM0YPm7c3Rrj0nfWHpklrA/9qNyKXuBJ0DxHYd3q+h0TDCn 9kUGznlu4df8ATmJmbY6daoyF4Uv4B11ykUU/+AYmPLJujKaI39a8/bDY55VMtelPy KrNSfbXV9S2lFYLfy8zUYXvDWZ1fg/WG3OrV0dCIrvXt0u2sCIVHfk0gU+sn58IecF oN8LuMs1R7bgOQ0pLd5IPS7h+QXmUuQ226FIBcEOqnaAwBGiE1NbLb3MivWMNLYXw+ I8pFl+C1rQUhg== Date: Tue, 24 Mar 2026 11:32:06 +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 2/7] mm: list_lru: deduplicate unlock_list_lru() Message-ID: References: <20260318200352.1039011-1-hannes@cmpxchg.org> <20260318200352.1039011-3-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-3-hannes@cmpxchg.org> On Wed, Mar 18, 2026 at 03:53:20PM -0400, Johannes Weiner wrote: > The MEMCG and !MEMCG variants are the same. lock_list_lru() has the > same pattern when bailing. Consolidate into a common implementation. > > Reviewed-by: David Hildenbrand (Arm) > Acked-by: Shakeel Butt > Signed-off-by: Johannes Weiner Nice, LGTM so: Reviewed-by: Lorenzo Stoakes (Oracle) > --- > mm/list_lru.c | 29 +++++++++-------------------- > 1 file changed, 9 insertions(+), 20 deletions(-) > > diff --git a/mm/list_lru.c b/mm/list_lru.c > index d96fd50fc9af..e873bc26a7ef 100644 > --- a/mm/list_lru.c > +++ b/mm/list_lru.c > @@ -15,6 +15,14 @@ > #include "slab.h" > #include "internal.h" > > +static inline void unlock_list_lru(struct list_lru_one *l, bool irq_off) > +{ > + if (irq_off) > + spin_unlock_irq(&l->lock); > + else > + spin_unlock(&l->lock); > +} > + > #ifdef CONFIG_MEMCG > static LIST_HEAD(memcg_list_lrus); > static DEFINE_MUTEX(list_lrus_mutex); > @@ -67,10 +75,7 @@ static inline bool lock_list_lru(struct list_lru_one *l, bool irq) > else > spin_lock(&l->lock); > if (unlikely(READ_ONCE(l->nr_items) == LONG_MIN)) { > - if (irq) > - spin_unlock_irq(&l->lock); > - else > - spin_unlock(&l->lock); > + unlock_list_lru(l, irq); > return false; > } > return true; > @@ -101,14 +106,6 @@ lock_list_lru_of_memcg(struct list_lru *lru, int nid, struct mem_cgroup *memcg, > memcg = parent_mem_cgroup(memcg); > goto again; > } > - > -static inline void unlock_list_lru(struct list_lru_one *l, bool irq_off) > -{ > - if (irq_off) > - spin_unlock_irq(&l->lock); > - else > - spin_unlock(&l->lock); > -} > #else > static void list_lru_register(struct list_lru *lru) > { > @@ -147,14 +144,6 @@ lock_list_lru_of_memcg(struct list_lru *lru, int nid, struct mem_cgroup *memcg, > > return l; > } > - > -static inline void unlock_list_lru(struct list_lru_one *l, bool irq_off) > -{ > - if (irq_off) > - spin_unlock_irq(&l->lock); > - else > - spin_unlock(&l->lock); > -} > #endif /* CONFIG_MEMCG */ > > /* The caller must ensure the memcg lifetime. */ > -- > 2.53.0 >