lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 11 Dec 2015 15:14:47 +0900
From:	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To:	Weijie Yang <weijie.yang@...sung.com>
Cc:	'Andrew Morton' <akpm@...ux-foundation.org>,
	'Minchan Kim' <minchan@...nel.org>,
	sergey.senozhatsky.work@...il.com, ngupta@...are.org,
	linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] zsmalloc: reorganize struct size_class to pack 4 bytes
 hole

Cc linux-mm and linux-kernel

On (12/11/15 13:20), Weijie Yang wrote:
> 
> Reoder the pages_per_zspage field in struct size_class which can eliminate
> the 4 bytes hole between it and stats field.
> 

Looks good to me.

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@...il.com>

> Signed-off-by: Weijie Yang <weijie.yang@...sung.com>
> ---
>  mm/zsmalloc.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 9f15bdd..e7414ce 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -213,10 +213,10 @@ struct size_class {
>  	int size;
>  	unsigned int index;
>  
> -	/* Number of PAGE_SIZE sized pages to combine to form a 'zspage' */
> -	int pages_per_zspage;
>  	struct zs_size_stat stats;
>  
> +	/* Number of PAGE_SIZE sized pages to combine to form a 'zspage' */
> +	int pages_per_zspage;
>  	/* huge object: pages_per_zspage == 1 && maxobj_per_zspage == 1 */
>  	bool huge;
>  };


we also can re-order `struct zs_pool' -- `gfp_t flags' and `bool shrinker_enabled'
will be fine together.

I can send a separate patch of we can fold the one below.
I'm good either way.

---

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 9f15bdd..2a3af25 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -246,19 +246,17 @@ struct zs_pool {
 
 	struct size_class **size_class;
 	struct kmem_cache *handle_cachep;
-
-	gfp_t flags;	/* allocation flags used when growing pool */
-	atomic_long_t pages_allocated;
-
 	struct zs_pool_stats stats;
-
-	/* Compact classes */
-	struct shrinker shrinker;
+	atomic_long_t pages_allocated;
+	/* allocation flags used when growing pool */
+	gfp_t flags;
 	/*
 	 * To signify that register_shrinker() was successful
 	 * and unregister_shrinker() will not Oops.
 	 */
 	bool shrinker_enabled;
+	/* Compact classes */
+	struct shrinker shrinker;
 #ifdef CONFIG_ZSMALLOC_STAT
 	struct dentry *stat_dentry;
 #endif

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ