From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (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 1041236CE16 for ; Wed, 18 Mar 2026 20:51:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773867074; cv=none; b=XTcLiWoFkTXVVFR8HZt+xY5NE0b1p5wNq5fOEXxeQEmYa5IGkTiANEO3qYjmcfPPOhtgCEq+A7H8psVHv8TShC5ohZJcjOj+pMYDh3DJjvlP7HZtWSpKMF4tU3M7yXQob0UgS5b8hdkAsa6a+k1dCwwsy8OPeo/qknuo1gWYnpQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773867074; c=relaxed/simple; bh=as2GBT7agVMDUtrQcAqsVTpbMTQbvlkCOmkMcF9nq8c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uMvyUs7dozISi4DgAuhlb2KYUJf5i9Qi7FB2sOLvYEVP6fQ4H4W4oG7z5HtSaP6H7ADSiFsWgtijrIBSTMbj3TdKoH+HZJfIud21movucH5dgHX4Ak0TzrnhwaMtC8UfYNPtq+vi4Yu+0fdxP7BxB2xPBYxI96G9ELxE7awjZIg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=mFHpCUO9; arc=none smtp.client-ip=91.218.175.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="mFHpCUO9" Date: Wed, 18 Mar 2026 13:51:04 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1773867069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jDhgcdQYWRAHbCXaMJOJeJyqhIY2pecR4Pfu9w08Mv4=; b=mFHpCUO9u/MBt+HlQ4/bAC6fqp/6hRvvArE/ZHsnEH0ftY4GgtNSEzSkYaECsW/OIH82f4 ZnxjNGU+1oGBPG5ywjZqo0SehMqDV2OqR3L40gZvOynVuLoWuyabk5dS5+GtCusmKIb1pp f7ao7LbzaGJCsv3FCfN7NDix8HhROHA= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Johannes Weiner Cc: Andrew Morton , David Hildenbrand , 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 5/7] mm: list_lru: introduce caller locking for additions and deletions Message-ID: References: <20260318200352.1039011-1-hannes@cmpxchg.org> <20260318200352.1039011-6-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-6-hannes@cmpxchg.org> X-Migadu-Flow: FLOW_OUT On Wed, Mar 18, 2026 at 03:53:23PM -0400, Johannes Weiner wrote: > Locking is currently internal to the list_lru API. However, a caller > might want to keep auxiliary state synchronized with the LRU state. > > For example, the THP shrinker uses the lock of its custom LRU to keep > PG_partially_mapped and vmstats consistent. > > To allow the THP shrinker to switch to list_lru, provide normal and > irqsafe locking primitives as well as caller-locked variants of the > addition and deletion functions. > > Reviewed-by: David Hildenbrand (Arm) > Signed-off-by: Johannes Weiner One nit below, other than that: Acked-by: Shakeel Butt > > -static inline void lock_list_lru(struct list_lru_one *l, bool irq) > +static inline void lock_list_lru(struct list_lru_one *l, bool irq, > + unsigned long *irq_flags) > { > - if (irq) > + if (irq_flags) > + spin_lock_irqsave(&l->lock, *irq_flags); > + else if (irq) If we move __list_lru_walk_one to use irq_flags then we can remove the irq param. It is reclaim code path and I don't think additional cost of irqsave would matter here.