diff mbox series

[v4,28/32] mm/slub: Simplify struct slab slabs field definition

Message ID 20220104001046.12263-29-vbabka@suse.cz (mailing list archive)
State New
Headers show
Series Separate struct slab from struct page | expand

Commit Message

Vlastimil Babka Jan. 4, 2022, 12:10 a.m. UTC
Before commit b47291ef02b0 ("mm, slub: change percpu partial accounting
from objects to pages") we had to fit two integer fields into a native
word size, so we used short int on 32-bit and int on 64-bit via #ifdef.
After that commit there is only one integer field, so we can simply
define it as int everywhere.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/slab.h | 4 ----
 1 file changed, 4 deletions(-)

Comments

Roman Gushchin Jan. 6, 2022, 4:13 a.m. UTC | #1
On Tue, Jan 04, 2022 at 01:10:42AM +0100, Vlastimil Babka wrote:
> Before commit b47291ef02b0 ("mm, slub: change percpu partial accounting
> from objects to pages") we had to fit two integer fields into a native
> word size, so we used short int on 32-bit and int on 64-bit via #ifdef.
> After that commit there is only one integer field, so we can simply
> define it as int everywhere.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
>  mm/slab.h | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/mm/slab.h b/mm/slab.h
> index b8da249f44f9..362832f465e6 100644
> --- a/mm/slab.h
> +++ b/mm/slab.h
> @@ -27,11 +27,7 @@ struct slab {
>  		struct rcu_head rcu_head;
>  		struct {
>  			struct slab *next;
> -#ifdef CONFIG_64BIT
>  			int slabs;	/* Nr of slabs left */
> -#else
> -			short int slabs;
> -#endif

Very nice!

Reviewed-by: Roman Gushchin <guro@fb.com>
diff mbox series

Patch

diff --git a/mm/slab.h b/mm/slab.h
index b8da249f44f9..362832f465e6 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -27,11 +27,7 @@  struct slab {
 		struct rcu_head rcu_head;
 		struct {
 			struct slab *next;
-#ifdef CONFIG_64BIT
 			int slabs;	/* Nr of slabs left */
-#else
-			short int slabs;
-#endif
 		};
 	};
 	struct kmem_cache *slab_cache;