mm/slub: remove forced_order parameter in calculate_sizes
Subsystems (2)
PATCH 1/1 mm/slub: remove forced_order parameter in calculate_sizes
Since commit 32a6f409b693 ("mm, slub: remove runtime allocation order changes"), forced_order is always -1. Remove this unneeded parameter to simplify the code.
--- mm/slub.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
mm/slub.c +4 -7
@@ -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; } }
Signature · 1 line
2.23.0
Quoted 44 lines · Miaohe Lin
Since commit
32a6f409b693("mm, slub: remove runtime allocation order changes"),forced_orderis always -1. Remove this unneeded parameter to simplify the code.Signed-off-by Miaohe Lin <[email protected]>--- mm/slub.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)mm/slub.c +3
-6@@ -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) {/*
mm/slub.c static int kmem_cache_open(struct kmem_cache *s, slab_flags_t flags) · line 4194
Quoted 8 lines
mm/slub.c +1
-1@@ -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.
Thanks!
Quoted 2 lines
Signature · 1 line
2.23.0
--
Thank you, You are awesome!
Hyeonggon :-)
Quoted 56 lines · Hyeonggon Yoo
Quoted 44 lines · Miaohe Lin
Since commit
32a6f409b693("mm, slub: remove runtime allocation order changes"),forced_orderis always -1. Remove this unneeded parameter to simplify the code.Signed-off-by Miaohe Lin <[email protected]>--- mm/slub.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)mm/slub.c +3
-6@@ -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) {/* mm/slub.c static int kmem_cache_open(struct kmem_cache *s, slab_flags_t flags) · line 4194
Quoted 8 lines
mm/slub.c +1
-1@@ -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.
Quoted 1 line
Reviewed-by Hyeonggon Yoo <[email protected]>
Thanks both, added to slab-next
Quoted 8 lines
Thanks!
Quoted 2 lines
Signature · 1 line
2.23.0--
Thank you, You are awesome!
Hyeonggon :-)