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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180719111400.GY7193@dhcp22.suse.cz>
Date:   Thu, 19 Jul 2018 13:14:00 +0200
From:   Michal Hocko <mhocko@...nel.org>
To:     Kirill Tkhai <ktkhai@...tuozzo.com>
Cc:     akpm@...ux-foundation.org, vdavydov.dev@...il.com,
        penguin-kernel@...ove.SAKURA.ne.jp, chris@...is-wilson.co.uk,
        gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] mm: Make flags of unsigned type in struct shrinker

On Thu 19-07-18 13:51:27, Kirill Tkhai wrote:
> Currently, there are two flags only, so unsigned
> is more then enough. Also, move int seeks to keep
> these fields together.

a slightly more explanation _why_ would be really helpful. I suspect
this is to pack the structure better,

struct shrinker {
	long unsigned int          (*count_objects)(struct shrinker *, struct shrink_control *); /*     0     8 */
	long unsigned int          (*scan_objects)(struct shrinker *, struct shrink_control *); /*     8     8 */
	int                        seeks;                /*    16     4 */

	/* XXX 4 bytes hole, try to pack */

	long int                   batch;                /*    24     8 */
	long unsigned int          flags;                /*    32     8 */
	struct list_head           list;                 /*    40    16 */
	atomic_long_t *            nr_deferred;          /*    56     8 */
	/* --- cacheline 1 boundary (64 bytes) --- */

	/* size: 64, cachelines: 1, members: 7 */
	/* sum members: 60, holes: 1, sum holes: 4 */
};

suggests so. Which is a good thing.

> Signed-off-by: Kirill Tkhai <ktkhai@...tuozzo.com>

other than that looks reasonable to me
Acked-by: Michal Hocko <mhocko@...e.com>
> ---
>  include/linux/shrinker.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
> index d58aaaed34a4..9443cafd1969 100644
> --- a/include/linux/shrinker.h
> +++ b/include/linux/shrinker.h
> @@ -63,9 +63,9 @@ struct shrinker {
>  	unsigned long (*scan_objects)(struct shrinker *,
>  				      struct shrink_control *sc);
>  
> -	int seeks;	/* seeks to recreate an obj */
>  	long batch;	/* reclaim batch size, 0 = default */
> -	unsigned long flags;
> +	int seeks;	/* seeks to recreate an obj */
> +	unsigned flags;
>  
>  	/* These are for internal use */
>  	struct list_head list;

-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ