linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: SeongJae Park <sj@kernel.org>, akpm@linux-foundation.org
Cc: willy@infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Christoph Lameter <cl@linux.com>,
	David Rientjes <rientjes@google.com>,
	Hyeonggon Yoo <42.hyeyoo@gmail.com>
Subject: Re: [PATCH] mm/sl{a,u}b: fix wrong usages of folio_page() for getting head pages
Date: Tue, 10 Jan 2023 15:28:12 +0100	[thread overview]
Message-ID: <1e862dbf-1618-c546-f0d9-ca54f129285c@suse.cz> (raw)
In-Reply-To: <20230110005124.1609-1-sj@kernel.org>

On 1/10/23 01:51, SeongJae Park wrote:
> The standard idiom for getting head page of a given folio is
> '&folio->page', but some are wrongly using 'folio_page(folio, 0)' for
> the purpose.  Fix those to use the idiom.
> 
> Suggested-by: Matthew Wilcox <willy@infradead.org>
> Signed-off-by: SeongJae Park <sj@kernel.org>

Thanks, pushed to slab/for-6.3/cleanups

> ---
>  mm/slab.c | 4 ++--
>  mm/slub.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/slab.c b/mm/slab.c
> index b77be9c6d6b1..a5398676dc60 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -1389,7 +1389,7 @@ static void kmem_freepages(struct kmem_cache *cachep, struct slab *slab)
>  
>  	BUG_ON(!folio_test_slab(folio));
>  	__slab_clear_pfmemalloc(slab);
> -	page_mapcount_reset(folio_page(folio, 0));
> +	page_mapcount_reset(&folio->page);
>  	folio->mapping = NULL;
>  	/* Make the mapping reset visible before clearing the flag */
>  	smp_wmb();
> @@ -1398,7 +1398,7 @@ static void kmem_freepages(struct kmem_cache *cachep, struct slab *slab)
>  	if (current->reclaim_state)
>  		current->reclaim_state->reclaimed_slab += 1 << order;
>  	unaccount_slab(slab, order, cachep);
> -	__free_pages(folio_page(folio, 0), order);
> +	__free_pages(&folio->page, order);
>  }
>  
>  static void kmem_rcu_free(struct rcu_head *head)
> diff --git a/mm/slub.c b/mm/slub.c
> index 67020074ecb4..d5f20c062004 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -2066,7 +2066,7 @@ static void __free_slab(struct kmem_cache *s, struct slab *slab)
>  	if (current->reclaim_state)
>  		current->reclaim_state->reclaimed_slab += pages;
>  	unaccount_slab(slab, order, s);
> -	__free_pages(folio_page(folio, 0), order);
> +	__free_pages(&folio->page, order);
>  }
>  
>  static void rcu_free_slab(struct rcu_head *h)



  reply	other threads:[~2023-01-10 14:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10  0:51 SeongJae Park
2023-01-10 14:28 ` Vlastimil Babka [this message]
2023-01-10 14:41 ` David Hildenbrand
2023-01-11  9:36 ` Hyeonggon Yoo

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=1e862dbf-1618-c546-f0d9-ca54f129285c@suse.cz \
    --to=vbabka@suse.cz \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=sj@kernel.org \
    --cc=willy@infradead.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