From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (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 4AC873346B4 for ; Thu, 21 May 2026 15:03:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779375826; cv=none; b=dIriSQtRD8HNnlYK2URYLThud8tIhaZ+T1dvWjk98XlCGQ8YZhvlM2OY6KeOcGyMG2uTGPN8hteFMwI5ZrtG4Bd6EyDO+A53eTD+Yqir2TiRhn09I6Re33i6iZFqmqVF7otMicR1b+HCpXSGJ6SFhXE4DavVJ6uAGxOMfu88HXo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779375826; c=relaxed/simple; bh=U8Z3an3hNgZrCxyekQRPWZceUjB6u0warXZQZI9zDco=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TKCnS+GfcJxFgecIEs26spyPzr3t8opb5dVlaBpyt1ifjfJyD1sJhYqm4PGQtSmfK8YR0wvZcGP10vUcvG9E5gnWcAwrjWyG7FmKng/RiXLVgoeAx4eDLgKMZzB0nbV+2yJn0OwMdK2BURQq7dxdz8UKYjGHVcyrsZofexe0Amo= 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=MPLRq5Vc; arc=none smtp.client-ip=209.85.167.175 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="MPLRq5Vc" Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-484d3c0855aso2439979b6e.3 for ; Thu, 21 May 2026 08:03:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1779375824; x=1779980624; 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=1cbAO2KW+lIj5NuloFoDpyrLcHnbVUzz5CiT+zyYy0s=; b=MPLRq5Vcn/sK/aXPgD0CaHvegRRF9M1+l6r0nhCwNEvOD9feeAEykYn1oixuTqPTH5 BLplBfvM0g/y/PrmXWRgraUG/7uslPVrpAoauviD0iQjAO20owdE44O/3Peczfyk7yRG E17LbfVG+8AwU7wLlDpTRzKHddUYIlXSI36UBxyCyNxTeL1DBqHAgbTVlw+h1YmgUx3+ YpvsIR5bgt3OHUyVXRhck7Sf/RuTURNQ/uAEHML9mK4VLN0b0uJo8iy1gD27ybn2HwXU izgu3Erd4l5jS3zsNOPp/EzMw3YpnVEG+45F0ximUypIFk4hH/M9zZhennlZFeD6qsP+ 2iBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779375824; x=1779980624; 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=1cbAO2KW+lIj5NuloFoDpyrLcHnbVUzz5CiT+zyYy0s=; b=S0Ync3voJV2PJvkEcmsoWOG+ujKpvtCV+4ANZa6t8MZCHMvfS6lCLODRSDhGFl5BOX UcgXCHiQ/cRwhh3CQ/XRoPVTEl0o3Txh6eZTbmTvn9hJGe59ooK7QAuHYemkdTWNNgTt Yp9MaY54f/b9AcGVMeCrNk+vyTsc1zwRpDBQVwstKQPKxrJNlO+AniwJ8NFj8odCs0LZ f7lWD9AIgc52rQJ397AM75syccg4kD+u8I+IpW8iCh3ggfun/2rXtVVEFWJoHRRvqbDv C4ZkVTDuv3GH0BDJOzxDayl1zPCutAe8+oZMiRzYD5T797ehav6y26DxrD00yG/DKWjY e7IQ== X-Forwarded-Encrypted: i=1; AFNElJ84zUH+frULdOnHjtJ3IgRQVTukED6h5aorErVIGh7pENm2Cw/jw9VUWvi00nSyKNKra3vMgRkTxkQ+lWA=@vger.kernel.org X-Gm-Message-State: AOJu0YzK5hcydioC43SWry24LkFJ3aIQkpLiRjFSzJNAikqGAtBV0zC2 4+14zJsgndh64rWCY3yROvJ0NVY68l8iGb1SOMnyDYoFPFa62Y1NRAQYuVuB/K4LUnA= X-Gm-Gg: Acq92OHph2NWm4B5VvGFvUqrz/mswLg2JW/PgkX06l7jsdITtGGz9WvpkRZM4HLl3cI 1i4ztsTwcBl46z1BN0m17+V/a+lPKjs3Co0eLoEO48HocqQ98OKN7T38MFftDcbPNLuXVRp6ELx 2WIw1s+CWXZsSHGFxO7eqbpv/goaiduBi6fiKCDapRrqjwU+70jqX+2l+JlzY3RSHEoSxk3LVni qsT8mFzR9RMAsBOYL9xehL6B58oX4AGT53rdRYsv26fkEE50sGoA0dsG9Hu7yNlKM6xFPYQkISy I+Y5Z82C58wp7ZTw+CwNmtnpGOnXFXojomlSrcAttQ4ba+FlM0klfCPOB9R443hv1IC4qmjKF5F 7s6d0QFjaetFoNjcD7OyIzbEKv31qfaYqn43OeZ1Jy5HgQFK1P7SmGssDEaF7TAB1kW0vp64k4j NFav+/39tRY5voIR8bic4RyA== X-Received: by 2002:a05:6808:2221:b0:467:1941:1f0d with SMTP id 5614622812f47-4852eb590aemr1685571b6e.11.1779375823781; Thu, 21 May 2026 08:03:43 -0700 (PDT) Received: from localhost ([2603:7001:f100:500:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-516cce102f7sm8647231cf.22.2026.05.21.08.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 08:03:42 -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 v4 1/8] mm: list_lru: lock_list_lru_of_memcg() cannot return NULL if !skip_empty Date: Thu, 21 May 2026 11:02:07 -0400 Message-ID: <20260521150330.1955924-2-hannes@cmpxchg.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260521150330.1955924-1-hannes@cmpxchg.org> References: <20260521150330.1955924-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: 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 --- 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 dd29bcf8eb5f..d3619961a7ac 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 */ @@ -204,9 +202,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