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 E36EE3630A4 for ; Tue, 24 Mar 2026 11:30:45 +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=1774351846; cv=none; b=dI4JZ2xuTzBmYO9QfO1oma1vrsiqDmgDma5UFaCo9Ess+T0Je0MZVqXwTYFu5sR77A7Bm7GuKR73E8H77h0sat+5OGtL0EPF+m0sJM+HyJigydv5Dl19DxN4H4NPx4Xi1Ni7dL7PGpmLtW3Vke0pk6S4Owmt75S54u2/HW1Fdok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774351846; c=relaxed/simple; bh=MFvA2pyzKBSEMblCGyfJgCaGyk4nadGEKVsMvBEPeQI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ca6p7yIwK36KiY7jsffeLVLAVrTbrFkcLVrEEsbPqzMtCtEF8NDZxYjLo5XVcx0qunEj5fJZzy3ni3v7W/Ez/93uZ0pmHun9tSgiCfUFl1rfqoVef/wODifKHTQs5QeZg07AZDD40v0D7jai/kHbdYUOe0/KoPymy/unvP00EEo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N/unreGe; 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="N/unreGe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F829C19424; Tue, 24 Mar 2026 11:30:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774351845; bh=MFvA2pyzKBSEMblCGyfJgCaGyk4nadGEKVsMvBEPeQI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N/unreGeVGiKZeD6Evz1AHjWkkunhST2s7AzH8M9wYcj0qnPOTCwJQ3q/Fipe9iup 3Hs2p0NtVbQcNSuJT+m3zEdJzuBOv8SFxTrDSqmSFwFhcOc8rNb9evrK9jHehVlIDl keH+Nd+AFsArX9rY/PaVqPCdk6FYK2oNZObsx9mxqBXgBl6l1B8JTRUq9/9C0/7p4r dYFMHHh6bPdxszFctLBsGe0SeJNN52PKz1G+wJ2D681MQ/0F1aZIe1j4DwI5jE/jXA DRllQGw9pEt7U59xaIHHb1DQgIg0nTME8NZC8QDSgkzvBC9PwodH9VBf+hupbVkJjx mFBlVOztnkoEw== Date: Tue, 24 Mar 2026 11:30:42 +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 1/7] mm: list_lru: lock_list_lru_of_memcg() cannot return NULL if !skip_empty Message-ID: <375b41d1-6fcb-4b79-889e-20e4b4fbcf02@lucifer.local> References: <20260318200352.1039011-1-hannes@cmpxchg.org> <20260318200352.1039011-2-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-2-hannes@cmpxchg.org> On Wed, Mar 18, 2026 at 03:53:19PM -0400, Johannes Weiner wrote: > skip_empty is only for the shrinker to abort and skip a list that's > empty or whose cgroup is being deleted. > > For list additions and deletions, the cgroup hierarchy is walked > upwards until a valid list_lru head is found, or it will fall back to > the node list. Acquiring the lock won't fail. Remove the NULL checks > in those callers. > > Reviewed-by: David Hildenbrand (Arm) > Signed-off-by: Johannes Weiner LGTM, as !skip_empty and so that just isn't possible, so: Reviewed-by: Lorenzo Stoakes (Oracle) > --- > mm/list_lru.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/mm/list_lru.c b/mm/list_lru.c > index 26463ae29c64..d96fd50fc9af 100644 > --- a/mm/list_lru.c > +++ b/mm/list_lru.c > @@ -165,8 +165,6 @@ bool list_lru_add(struct list_lru *lru, struct list_head *item, int nid, > struct list_lru_one *l; > > l = lock_list_lru_of_memcg(lru, nid, memcg, false, false); > - if (!l) > - return false; > if (list_empty(item)) { > list_add_tail(item, &l->list); > /* Set shrinker bit if the first element was added */ > @@ -203,9 +201,8 @@ bool list_lru_del(struct list_lru *lru, struct list_head *item, int nid, > { > struct list_lru_node *nlru = &lru->node[nid]; > struct list_lru_one *l; > + > l = lock_list_lru_of_memcg(lru, nid, memcg, false, false); > - if (!l) > - return false; > if (!list_empty(item)) { > list_del_init(item); > l->nr_items--; > -- > 2.53.0 > Cheers, Lorenzo