From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.174 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793973973; b=IAkYSinZkQKGOJi4OJEVhuaY+KCfi4V/fXhY3A45BJUv6+s+bZFsUqM4hRwGP+FEMj5I BGKC0QFRwcSgcNJYdTW/sRGLLWlsXU0NKwZyBuoeB2gTdjRCfzTkIyt6nEhpLqoehLApn i9w6QgfkIttS8UaIYHq7EbaHUwFwsEwVfyseotghrl4VW+vCJB11wIqrApGVs1chcqSaz Sxuyjy5gl5ZZ2mHqKWiRbJFm2hEbwtlnjMmxU93ITSO5234vnYX1Gh5cKjVT54UN5H6wN JFCytCtaXsM7A+iwhNULfK9yn2gCpDTx8c/CjyJefktK5+0udu4sSU7Y/gTakkxtnNQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793973973; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=eqhBVbUtw3dy734MGt0XscJMrayl/heBjdE55TwHpBE=; b=OV+KD2Ao32WVq7rq5QgtJWG+yC4a32aN17klSD5hseRU2FClg+Bag7ASlCcdre6mt1t0 4m/0o3kQDajgKCrGdJZBdNuoAYBu5y63sqqbDvPE3IQYk9WlsuqlNUKwHZnZphapEKxlR eMnNnLOQ79dnMJIIK6chm4l7EYYHdz4/rRjpRf9/UDUczM6cl/n7U4S6LzbrzB9FioTnp /WNbjikshnaTTDcLCfZKZg4s/U82xc6RyDC9c1SrBhR3HK6fgMIHqewVhysEdo4mQoyap v7UDWIpSObEtRF3GREMhIqITywrntjm4Q6EbxDZbf4YV66v/YZzzFhbW+uM3qhaPOlw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; arc=none smtp.remote-ip=209.85.128.174 Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6C53606A32D for ; Fri, 6 Nov 2026 14:06:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D6C53606A32D 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 Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-8b0d63f60bcso7616487b3.3 for ; Fri, 06 Nov 2026 06:06:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1793973967; x=1794578767; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=eqhBVbUtw3dy734MGt0XscJMrayl/heBjdE55TwHpBE=; b=rEFjIsRctA59Iu2/BHBn1Bio1Z530ac+g4EEE4umpjlRFctJ/W1yi+oJAJdR8sIKtC 0ANk4+IEeh+gWZdP8+5Abj0Wi+7JUGtI3eOPnJ0wMnngrGVtvT7+mdXKDwBc4VjMOreA HRXNX16MAj9gPw3V6sQG29RsCMeifuq7vktm82eZ1OL9M0wUFDM8b1mHYrWOWDjP7hoA FgchrqECOX93FzgDhG9Sn07L+FCR1PCSxN8pDG5a+ABli7EEuG5ifSugYUsuO9WbK3uX 2labLzJdsWWlMl8/Ibz30wICnbSFS6Rx+DAJRAtH3OrhgDaH9x+c/HNq/PuJNNkUGIVa 0UdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793973967; x=1794578767; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=eqhBVbUtw3dy734MGt0XscJMrayl/heBjdE55TwHpBE=; b=v7tQNRLkFW/We5byIOtIQmZGWa10fxxr3tAf5V8QI71UDbsrwTDLI8h5sMnB61rVnX GnmIRf4EgCR4/GV5lNkUuc3vpDdju8Aq8F74UQzarDPKOiD4htxJbPrGwuW7JBOadl/F uG175r7IO3x8I0JdoMNqTeAvjbXUYGl4AEe/lbWop0eedX4fumnyIdXnX2p/9GEcWgCN Ffi0PqjgR7klun29WQQ7X75mdyLft8GGyTVTNsBISc807gtQdZ7+ZwuyCBR5Rpro9RfV 8cUYI9Hx882reGs9bzf0jdVytkpcYi8r9vt9ZYx/JLYSR7DDK8BO3LszPdodxIXNscmI 4jMQ== X-Forwarded-Encrypted: i=1; AL+hErH23Lv9DzxgcgWQMXOZWqZeko1N1a9ko8SYcOA3kGSygH81PVAfzpC2G7SKZsRUFTRFi4BxlWSa/KBBm9FL@vger.kernel.org X-Gm-Message-State: APuU4Z9Bz+i7EV+XbH/oMaMoKJ6pt90k/svkvW3xVxvvhdrFZh6aL3Ip Ox224HHqWirRXtdk5yZ3f/3KBev0K/Pe3JddqfDaQNm5WTqpxkqHnP5JlycM1bsMnFA= X-Gm-Gg: AYBFou3diGyLjym5IvV5JAsc9kkO9L0nz6d/NOsh6lTlW/hG4F3NCEl+0mABoK4SxLd 7sMbNQpuLe89NOzempiFEzZiu1wNsuCUYzuGUTVzJVHjHKeff0dU6Up9/jKwDklMsjrxrsx6D7n s1KkcxDJCjICXOmpIhRtVqMND6uNc3Wyw5FoaPXUmOhJVZoY3J+PkYjuvFeS21+Cgznd97VA8DF dFvb+fyp4yJtyAhZIgFxQifIyiW3ZzsfcBEVbbVLUlL5sViYKKoyYHHgoZdCfPlLROi22Ez7rME qjcp6ftRWIqRcpanlmoWjw0ncf52Au9yT/nqZ9OLbYQdmTj92VJkWYCpalhuYol6fMM0kyahwj2 WM/OiXfy9vDnvpbI5srzesRtZFRYEe9nbkt8PJr0paaKpohYqYp70VmL6TeWRmqrmJNGmtBTw/o zZ2ZIt6Vq02NeUQGpgaN7tymgonMB7r7ZbEKAHCQjZG9AELjYEB6LrnDgiCCw0sHZ0+6LkJlVL0 cyzL7/wgEIkTSM6sFUuZa3d0Ix3V4xSuTZQ7wkqaQIL8pG/Y1e2Zzo06sFHSUR9qn+hidhpz+qo FdxHUyhed5rVP5jtuEb6KYP+0yeh X-Received: by 2002:a05:690c:560f:10b0:8b3:10df:54a3 with SMTP id 00721157ae682-8b341b1ebe2mr10611897b3.65.1793973966605; Fri, 06 Nov 2026 06:06:06 -0800 (PST) Received: from localhost ([2605:8600:200:14e3:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b33f856f99sm19108527b3.34.2026.11.06.06.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2026 06:06:04 -0800 (PST) Date: Fri, 6 Nov 2026 09:06:00 -0500 From: Johannes Weiner To: Dave Chinner Cc: Kaitao Cheng , gregkh@linuxfoundation.org, arve@android.com, tkjos@android.com, brauner@kernel.org, cmllamas@google.com, aliceryhl@google.com, nat@pixelcluster.dev, arunpravin.paneerselvam@amd.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, viro@zeniv.linux.org.uk, agruenba@redhat.com, trondmy@kernel.org, anna@kernel.org, cel@kernel.org, jlayton@kernel.org, cem@kernel.org, akpm@linux-foundation.org, david@fromorbit.com, david@kernel.org, hughd@google.com, yosry@kernel.org, nphamcs@gmail.com, matthew.auld@intel.com, matthew.brost@intel.com, thomas.hellstrom@linux.intel.com, jack@suse.cz, neil@brown.name, okorniev@redhat.com, Dai.Ngo@oracle.com, tom@talpey.com, qi.zheng@linux.dev, roman.gushchin@linux.dev, muchun.song@linux.dev, ziy@nvidia.com, baolin.wang@linux.alibaba.com, liam@infradead.org, nico.pache@linux.dev, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev, usama.arif@linux.dev, kas@kernel.org, mhocko@kernel.org, shakeel.butt@linux.dev, ljs@kernel.org, kasong@tencent.com, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, baoquan.he@linux.dev, chengming.zhou@linux.dev, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fsdevel@vger.kernel.org, gfs2@lists.linux.dev, linux-nfs@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, Kaitao Cheng Subject: Re: [PATCH] mm/list_lru: Account node removals in isolation helpers Message-ID: References: <20261103045053.59548-1-kaitao.cheng@linux.dev> X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Nov 04, 2026 at 07:47:09AM +1100, Dave Chinner wrote: > On Tue, Nov 03, 2026 at 12:50:53PM +0800, Kaitao Cheng wrote: > > From: Kaitao Cheng > > > > Successful writeback calls zswap_entry_free(), which removes the entry > > from the LRU and decrements both the sublist and node item counts. > > shrink_memcg_cb() then returns LRU_REMOVED_RETRY, causing the LRU walker > > to decrement the node count again. > > > > The affected call path before this change is: > > > > __list_lru_walk_one() > > shrink_memcg_cb() > > zswap_writeback_entry() > > zswap_entry_free() > > zswap_lru_del() > > list_lru_del() > > __list_lru_del() > > atomic_long_dec() /* first node count decrement */ > > return LRU_REMOVED_RETRY > > atomic_long_dec() /* second node count decrement */ > > That's a bug in the zswap code. You shouldn't be calling > list_lru_del() from __list_lru_walk_one() context. Grr, Kaitao you dropped the wrong thing that I thought had merit in my proposal... Dave, would you mind taking a look at my patch at https://lore.kernel.org/all/auJkvb-Lq0M5Enkz@cmpxchg.org/? Ignore zswap for a second. I know it has problems. Most of it stems from the fact that we rely on the swap locking and do none of our own locking/lifetime on the zswap entry. As a result we work around it in odd ways. Sorry, you didn't ask :-) That's worth revisiting, although it's likely more invasive work. The observation that led to the patch above was a much simpler one: since we now have the caller-locked __list_lru_del() anyway, the only difference between that and the list_lru_isolate* is the accounting. The patch is about one thing: removing the isolate helpers entirely. There is then simply one tool for caller-locked list unlinking, __list_lru_del(). It removes an avoidable distinction, shrinks the API surface, makes it harder to screw up. The zswap weirdness made me look at list_lru. Consider it a stress test from idiotic code :-) But I would propose the list_lru simplification for its own sake, regardless of what we do with zswap.