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 1/2] mm: Keep int fields in struct shrink_control together
Date: Thu, 19 Jul 2018 13:10:31 +0200	[thread overview]
Message-ID: <20180719111031.GX7193@dhcp22.suse.cz> (raw)
In-Reply-To: <153199747930.21131.861043607301997810.stgit@localhost.localdomain>

On Thu 19-07-18 13:51:19, Kirill Tkhai wrote:
> gfp_t is of unsigned type, so let's move nid to keep
> them together.

I guess you meant unsigned int so you can fill up a hole in
shrink_control and as such reduce the stack consumption a bit (at least
on 64b).

An output from pahole is usually a great tool to visualize this.

die__process_function: tag not supported (INVALID)!
struct shrink_control {
	gfp_t                      gfp_mask;             /*     0     4 */

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

	long unsigned int          nr_to_scan;           /*     8     8 */
	long unsigned int          nr_scanned;           /*    16     8 */
	int                        nid;                  /*    24     4 */

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

	struct mem_cgroup *        memcg;                /*    32     8 */

	/* size: 40, cachelines: 1, members: 5 */
	/* sum members: 32, holes: 2, sum holes: 8 */
	/* last cacheline: 40 bytes */
};

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

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  include/linux/shrinker.h |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
> index b154fd2b084c..d58aaaed34a4 100644
> --- a/include/linux/shrinker.h
> +++ b/include/linux/shrinker.h
> @@ -12,6 +12,9 @@
>  struct shrink_control {
>  	gfp_t gfp_mask;
>  
> +	/* current node being shrunk (for NUMA aware shrinkers) */
> +	int nid;
> +
>  	/*
>  	 * How many objects scan_objects should scan and try to reclaim.
>  	 * This is reset before every call, so it is safe for callees
> @@ -26,9 +29,6 @@ struct shrink_control {
>  	 */
>  	unsigned long nr_scanned;
>  
> -	/* current node being shrunk (for NUMA aware shrinkers) */
> -	int nid;
> -
>  	/* current memcg being shrunk (for memcg aware shrinkers) */
>  	struct mem_cgroup *memcg;
>  };

-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2018-07-19 11:10 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 [this message]
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

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=20180719111031.GX7193@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®