mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: akpm@linux-foundation.org, vdavydov.dev@gmail.com,
	penguin-kernel@I-love.SAKURA.ne.jp, chris@chris-wilson.co.uk,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mm: Make flags of unsigned type in struct shrinker
Date: Thu, 19 Jul 2018 13:14:00 +0200	[thread overview]
Message-ID: <20180719111400.GY7193@dhcp22.suse.cz> (raw)
In-Reply-To: <153199748720.21131.6476256940113102483.stgit@localhost.localdomain>

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@virtuozzo.com>

other than that looks reasonable to me
Acked-by: Michal Hocko <mhocko@suse.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

      reply	other threads:[~2018-07-19 11:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19 10:51 [PATCH 0/2] Reorderings in struct shrinker and struct shrink_control Kirill Tkhai
2018-07-19 10:51 ` [PATCH 1/2] mm: Keep int fields in struct shrink_control together Kirill Tkhai
2018-07-19 11:10   ` Michal Hocko
2018-07-19 11:14     ` Kirill Tkhai
2018-07-19 10:51 ` [PATCH 2/2] mm: Make flags of unsigned type in struct shrinker Kirill Tkhai
2018-07-19 11:14   ` Michal Hocko [this message]

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=20180719111400.GY7193@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=vdavydov.dev@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®