linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pedro Falcato <pfalcato@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: Re: [PATCH] mm: workingset: Simplify lockdep check in update_node
Date: Mon, 21 Apr 2025 18:39:53 +0100	[thread overview]
Message-ID: <bmzzod73cuumphqg6nyhegogc6wciyw7oewydljexni7tgdcni@32hathqdj7qo> (raw)
In-Reply-To: <20250421-workingset-simplify-v1-1-de5c40051e0e@suse.de>

On Mon, Apr 21, 2025 at 06:16:28PM +0100, Pedro Falcato wrote:
> container_of(node->array, ..., i_pages) just to access i_pages again
> is an incredibly roundabout way of accessing node->array itself.
> Simplify it.
> 
> Signed-off-by: Pedro Falcato <pfalcato@suse.de>
> ---
>  mm/workingset.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/workingset.c b/mm/workingset.c
> index 4841ae8af41113797378846f08336cd7c5757bd5..6e7f4cb1b9a7807e9288955f180a5b6cffab1a40 100644
> --- a/mm/workingset.c
> +++ b/mm/workingset.c
> @@ -612,7 +612,6 @@ struct list_lru shadow_nodes;
>  
>  void workingset_update_node(struct xa_node *node)
>  {
> -	struct address_space *mapping;
>  	struct page *page = virt_to_page(node);
>  
>  	/*
> @@ -623,8 +622,7 @@ void workingset_update_node(struct xa_node *node)
>  	 * already where they should be. The list_empty() test is safe
>  	 * as node->private_list is protected by the i_pages lock.
>  	 */
> -	mapping = container_of(node->array, struct address_space, i_pages);
> -	lockdep_assert_held(&mapping->i_pages.xa_lock);
> +	lockdep_assert_held(&node->array->xa_lock);
>  
>  	if (node->count && node->count == node->nr_values) {
>  		if (list_empty(&node->private_list)) {
> 

Actually, not sure if this is wanted given the original code is a little more
explicit on what the lock is. +CC the original author

If people think this is worse, just drop the patch, I don't really care - was just
checking out the function for other purposes and found this bit a little confusing.

-- 
Pedro


  reply	other threads:[~2025-04-21 17:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-21 17:16 Pedro Falcato
2025-04-21 17:39 ` Pedro Falcato [this message]
2025-04-23  2:07   ` Matthew Wilcox
2025-04-24 19:17 ` Johannes Weiner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bmzzod73cuumphqg6nyhegogc6wciyw7oewydljexni7tgdcni@32hathqdj7qo \
    --to=pfalcato@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox