From nobody Tue Apr 7 16:15:40 2026 Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D91EC38AC87 for ; Thu, 12 Mar 2026 20:53:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773348815; cv=none; b=Bihprp9F4UV7NrQ0d2r3Qxl6vR+WNjyXIHaIt5d/kp0jLicgEaAOUMaT8TTL8jiF9wvtvFdC/2sWjLeqlM3wRYs/5H1B0wU8rG1IUsoHdTFaZcBFUSvCy/pwM0my8eiS8NFZRC55u0EQrVv2xLl28SU/ilKL0m6lV5FTfJMccJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773348815; c=relaxed/simple; bh=Idr2THtP4YQirdU2zLaM8WYEx2j3lup/qgmJYBXFWVc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jp5v2+PzpW6GEO94k4celYZ/+i2eztJ2GKuIknEFagG5ZBhu4xwYKdKFaxNO5SxvnR/KDOT/JSFaT9Olyp0yGRhhn+mxEzVgypvuQavMqfTNI7w3jaZG9SdduLfD2qSeELOKyeNP/arizn17eEdMrlZCdzxvlkiYo2lgmH/RCoA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b=YWyGB41B; arc=none smtp.client-ip=209.85.219.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b="YWyGB41B" Received: by mail-qv1-f45.google.com with SMTP id 6a1803df08f44-89a1d7cc7f0so13427456d6.1 for ; Thu, 12 Mar 2026 13:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1773348811; x=1773953611; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Aqbg0K2IsgJ/qrqREwPFlBusaMsCq6IazOmM3TBzhTA=; b=YWyGB41BzS3caxKVY1COYMJB3FBJwTUYpXOUCtqUpaiXGoy6kmE1n/qxZUAI5qW1LB 8EAcfQ9itTmKEh60SgcdWPIeYLcnz1wyHebuneLxe5FCT7+C+C74G1ikLukj7Shsx8gw hodj6miAb7b4RKv5OmqXnE8aghBFS02QghrDVhsEHlyx62lMHH/3cluZ26H3ZDh2lcvR XudQevu8JwNUCkZ5Cq+UFjRSpPrYxGnb33Jh4x06OylU3UHOtifS8h/z/ZoQGz6DaPpe UsUW54zm/jlcJER8VsRDIM13UYI1Z79iImpAOsAo02jhjZcdSgwpDuA90kIHy/GLPYvL L6+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773348811; x=1773953611; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Aqbg0K2IsgJ/qrqREwPFlBusaMsCq6IazOmM3TBzhTA=; b=ErrnscF04mgT609NhxJ3sliMi6KpoIjtsRGfMZxyTSSgn2e388Wj82+UYSN9dyZ/Hg dvsazX8LBQzoxs2ivImFZo5i/fBeRo/Z1MYA2iI8+zvaIrFYfItR0qwj2fSPAJStw51t JpnqwaTpCQePoal80oHZkUDAYLZTHkzKxoQ4lLrecEfeOh0nQrB3tbexNad7Snp/BCpt +6NYj5g3FVW3h6rWhKdfLJYe+N9ih72KAjPzxfU1ck02XiILJJqe+dGWZG78Ba2ZRy/I e044SKZ0KEEvD2TPPWVJWZ5Wd9mghdlAowzcS+hrPP2+7K2JrAGPga4P1GLWz0ISH+6a GMcw== X-Forwarded-Encrypted: i=1; AJvYcCUcokNBleN+HQkx4mzya4hoCzq5frP9YFPClR2rMuTfs9zYy1T6Wg9TXGIdw2zJvfkykZWqivIDSDBPLJ0=@vger.kernel.org X-Gm-Message-State: AOJu0YxWe1eBUCGjFqRiUNao/BfalhwHKSP5PqYrMxjDQ9GYKyoGQ6W5 n90m3Zxig8L+DixCOAdutc/D4wpOzX9Ek30DPQMim3II0QH9NlONhA6JWBJLPJpD8To= X-Gm-Gg: ATEYQzwwKI7rOiPbJjejUa/eUd8mzuwzC/253HJQt5rw0zsQ1hLiIeeR9hgkeKI6qhr TpnDNh4laYFo+bfBCxCJFWdUGgHfqyk1qeUI1bZkOLbEoFvzyEUNXqLqrkV9k1PjD+PHctTXxxD BsrOvloB5wpTTMMUPRGrgltMdOK+DgOpixM3Kydvx40MFiyFmMQSnIcuqbTa+4ZBldiNA94QKV3 LGXSUqROiISY2yMS260GNJ2XtL+IvUWAem+cLLms/CteYoxC6nM6ksUB7vc2/NlEv3jXXSdSysp 2MYo88i8DspaocWrYparnFQf9E9t6Ogu5zBSke9Z31il/I06DjYbMwS7h/0fQ99ddnAWP0Nxl9e 5sj2pt0m6ynFeM0x17wz4vwP6JHUh9itL05pucPrXk7j3kbFE6dpwWzWuwO7oJwFFx6buxfcLOH qB2rvDB7jdiApUBaEy36NrEQ== X-Received: by 2002:a05:6214:1c41:b0:896:fa50:4c0c with SMTP id 6a1803df08f44-89a81f5282emr14261866d6.53.1773348811497; Thu, 12 Mar 2026 13:53:31 -0700 (PDT) Received: from localhost ([2603:7000:c00:3a00:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-89a65c0d327sm42509556d6.22.2026.03.12.13.53.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2026 13:53:30 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: 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: [PATCH v2 1/7] mm: list_lru: lock_list_lru_of_memcg() cannot return NULL if !skip_empty Date: Thu, 12 Mar 2026 16:51:49 -0400 Message-ID: <20260312205321.638053-2-hannes@cmpxchg.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260312205321.638053-1-hannes@cmpxchg.org> References: <20260312205321.638053-1-hannes@cmpxchg.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Johannes Weiner Reviewed-by: David Hildenbrand (Arm) --- 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_hea= d *item, int nid, struct list_lru_one *l; =20 l =3D 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_hea= d *item, int nid, { struct list_lru_node *nlru =3D &lru->node[nid]; struct list_lru_one *l; + l =3D 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--; --=20 2.53.0