All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hyeonggon Yoo <42.hyeyoo@gmail.com>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: akpm@linux-foundation.org, cl@linux.com, penberg@kernel.org,
	rientjes@google.com, iamjoonsoo.kim@lge.com, vbabka@suse.cz,
	roman.gushchin@linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/slub: remove forced_order parameter in calculate_sizes
Date: Wed, 9 Mar 2022 09:55:22 +0000	[thread overview]
Message-ID: <20220309095522.GA1091946@odroid> (raw)
In-Reply-To: <20220309092036.50844-1-linmiaohe@huawei.com>

On Wed, Mar 09, 2022 at 05:20:36PM +0800, Miaohe Lin wrote:
> Since commit 32a6f409b693 ("mm, slub: remove runtime allocation order
> changes"), forced_order is always -1. Remove this unneeded parameter
> to simplify the code.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  mm/slub.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 180354d7e741..7f09901ae6b2 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -4038,7 +4038,7 @@ static void set_cpu_partial(struct kmem_cache *s)
>   * calculate_sizes() determines the order and the distribution of data within
>   * a slab object.
>   */
> -static int calculate_sizes(struct kmem_cache *s, int forced_order)
> +static int calculate_sizes(struct kmem_cache *s)
>  {
>  	slab_flags_t flags = s->flags;
>  	unsigned int size = s->object_size;
> @@ -4142,10 +4142,7 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order)
>  	size = ALIGN(size, s->align);
>  	s->size = size;
>  	s->reciprocal_size = reciprocal_value(size);
> -	if (forced_order >= 0)
> -		order = forced_order;
> -	else
> -		order = calculate_order(size);
> +	order = calculate_order(size);
>  
>  	if ((int)order < 0)
>  		return 0;
> @@ -4181,7 +4178,7 @@ static int kmem_cache_open(struct kmem_cache *s, slab_flags_t flags)
>  	s->random = get_random_long();
>  #endif
>  
> -	if (!calculate_sizes(s, -1))
> +	if (!calculate_sizes(s))
>  		goto error;
>  	if (disable_higher_order_debug) {
>  		/*
> @@ -4191,7 +4188,7 @@ static int kmem_cache_open(struct kmem_cache *s, slab_flags_t flags)
>  		if (get_order(s->size) > get_order(s->object_size)) {
>  			s->flags &= ~DEBUG_METADATA_FLAGS;
>  			s->offset = 0;
> -			if (!calculate_sizes(s, -1))
> +			if (!calculate_sizes(s))
>  				goto error;
>  		}
>  	}

Looks good to me.

Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>

Thanks!

> -- 
> 2.23.0

--
Thank you, You are awesome!
Hyeonggon :-)


  reply	other threads:[~2022-03-09  9:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-09  9:20 [PATCH] mm/slub: remove forced_order parameter in calculate_sizes Miaohe Lin
2022-03-09  9:55 ` Hyeonggon Yoo [this message]
2022-03-09 11:31   ` Vlastimil Babka

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=20220309095522.GA1091946@odroid \
    --to=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.