From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (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 7784D3B7B8B for ; Wed, 27 May 2026 20:48:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779914894; cv=none; b=dBfzcHWb80lSCtBjoMLX9p8z3cfWf+xcMmeBCnPH7tkkT0gW1dMMcnop3/JxpkajrEZfvoqmy2RK0xEEefFrqHe7xE1kHelccPmHvmn3uLCrOAjCgJSaRLgohTUmkGIZdu/832j7rcucW8ZHpEOVm7bnu0Lqwu8RcvbKst9JD1I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779914894; c=relaxed/simple; bh=xYOAXmbD5tgE83jUvwcepWiOiMWhzYpTMw9lq13ecuk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=evsatfaeAInxr2p/Us3eRwX+Wmae9b/F8MzZoiFVtc6G7mvxi4x7kjP+CMjCSrFB3YhzZxIC7n3wvqOPNSVitd34FfmBaasj/gN5Arir5RKyRrwICn7JZfKErkFHNsshlraltapIi/LnlEMWOF/BZaZKVClsQdwm7r9p06JG58M= 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=FTUDVFrU; arc=none smtp.client-ip=209.85.160.172 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="FTUDVFrU" Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-51306c9f2a8so145159631cf.1 for ; Wed, 27 May 2026 13:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1779914889; x=1780519689; 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=TD5lidUUheRvEbRogBFjUkTmTjQ7nHIsLysSJlSHMzs=; b=FTUDVFrUX3A3O6aKdwycdgeHHiuAEC7hNluhlqdOI8Cj0NpsmgerS2K+2LQO2yfxZ4 i9vahFPakvJ9n2rwlEPcD8zdtG0SqVniCtfSV4fj8ri4DJc03lFvM/vAhNgVtwTaqNiU QMOr3+EWMsATYjOrwNU35ivBeWo/GStb03T5rmn9xWFOam6pZYYXr7Aj3CGop0ny2eB+ UHxEsZ3r+c0nNwcMatjCNrU473CdyXo/lhmgmk9ZcGTjFqOS4ugklF6ISfk+3tXmyVjB Gw1QAodXWcNJkq9bSYzQNS99ZT6NK6PdK1YRrvHoTXiHWwZdzD/zFRe4yow10o2xSNLE ep1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779914889; x=1780519689; 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=TD5lidUUheRvEbRogBFjUkTmTjQ7nHIsLysSJlSHMzs=; b=WfMRarniNaw+DBA4koG9ajK50SWcV4UUtkem67H9Skf3iO8stql+35EVZjde5f+SWY TqrE5PV7Nk3AvMPS2sTuN+h0SXotEHXuZqRj+vRy2VkTMtMoWPCIPMfG9krMHLL0x1dc d28aA8prl8nytU0F72BTc5gLTMMBZiwndWawtojNZsfPd8fsdzJ34HB32bXufC7kGZmy wuAqALEa4UiTGMkAyQkBqVcVoariKSjWVPpB6uyVkJIrRnVeez3S+GjpXV30SCxMuTtZ pzEPwlr4BNxviNoipLJJnjANkgsHSgj20kUxUDi7/zhxt50iIGF+xh/RlG8SKllR1HlJ C+ew== X-Forwarded-Encrypted: i=1; AFNElJ/vhGo8MZgT5DKhypMIvq8cskRdU3MY8DRZRRIKTuAp+u09k2k82ovAYOskAoEM/8cRBENePzrs@vger.kernel.org X-Gm-Message-State: AOJu0Yz7XhK/IhxaXRaPSKUyQhJLhRgy7xahOm2oaS+eYKVe/qJHMLmz FKytJC7WmHbOAyqZLvB3HqgeAwUbXS3jTELlNtKWzcUQzoTA+wUn+aDHoJqv+k5fp/4= X-Gm-Gg: Acq92OEEc6dd6kX4/usSqu78KEPWNF2Cplp9CFej68dUdikxWfYlRzIKb8dSjVPUqAV YbT5XxA0UqeW313SP2w+HVIBNbOUzO4hfGafu94RQPE0SHRzIuQu6ONm+MQsINbs93W7jpJtIJy pjVvuxDF1XrZyWWQF07icy1JPPLOWs2/D80aMJY0f7GPoCBox1Y9NfqhnPVlhx36qQ9DolOnpA8 MJRxyh9CfZGDmc9veIVkUU0OHHL+zI1LVd5xiF1tNbwdItblvAdxdbIQY9S8BqNYTVOOAIlJy9m JQ9ARX5RHN/xDzcQmDzuYIxVvrLkYdtBnY//quh6w0oOK3qtt84msywOZ51bUM4citNCdnmXhwC CBB3weR+pVRlWMZ48Z2c2z6WxPri6nDTjgQMdc1kieShYlP1eoJplC30FXo7eJ9ZcIgT4EgQ53R iAO9WkewAcaOWYv28+rM4LXx4CCmwRP8eB X-Received: by 2002:a05:622a:2508:b0:516:ddc3:622e with SMTP id d75a77b69052e-516ddc36797mr330589551cf.33.1779914889279; Wed, 27 May 2026 13:48:09 -0700 (PDT) Received: from localhost ([2603:7001:f100:500:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-51706adcb59sm52568411cf.17.2026.05.27.13.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2026 13:48:08 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: David Hildenbrand , Lorenzo Stoakes , Shakeel Butt , Michal Hocko , Dave Chinner , Roman Gushchin , Muchun Song , Qi Zheng , Yosry Ahmed , Zi Yan , "Liam R . Howlett" , Usama Arif , Kiryl Shutsemau , Vlastimil Babka , Kairui Song , Mikhail Zaslonko , Vasily Gorbik , Baolin Wang , Barry Song , Dev Jain , Lance Yang , Nico Pache , Ryan Roberts , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 2/9] mm: list_lru: lock_list_lru_of_memcg() cannot return NULL if !skip_empty Date: Wed, 27 May 2026 16:45:09 -0400 Message-ID: <20260527204757.2544958-3-hannes@cmpxchg.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260527204757.2544958-1-hannes@cmpxchg.org> References: <20260527204757.2544958-1-hannes@cmpxchg.org> Precedence: bulk X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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) Acked-by: Shakeel Butt Reviewed-by: Lorenzo Stoakes (Oracle) Signed-off-by: Johannes Weiner Reviewed-by: Liam R. Howlett (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 45d1b97737ea..77999ed78fa5 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); /* @@ -208,9 +206,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.54.0