mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Oleg Nesterov <oleg@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH] uprobes: Re-order struct uprobe_task to save some space
Date: Sun, 3 Nov 2024 13:55:48 +0900	[thread overview]
Message-ID: <20241103135548.0c19e1a1451e598c18d8c42f@kernel.org> (raw)
In-Reply-To: <a9f541d0cedf421f765c77a1fb93d6a979778a88.1730495562.git.christophe.jaillet@wanadoo.fr>

On Fri,  1 Nov 2024 22:13:33 +0100
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> On x86_64, with allmodconfig, struct uprobe_task is 72 bytes long, with a
> hole and some padding.
> 
> 	/* size: 72, cachelines: 2, members: 7 */
> 	/* sum members: 64, holes: 1, sum holes: 4 */
> 	/* padding: 4 */
> 	/* forced alignments: 1, forced holes: 1, sum forced holes: 4 */
> 	/* last cacheline: 8 bytes */
> 
> Reorder the structure to fill the hole and avoid the padding.
> 
> This way, the whole structure fits in a single cacheline and some memory is
> saved when it is allocated.
> 
> 	/* size: 64, cachelines: 1, members: 7 */
> 	/* forced alignments: 1 */
> 

Looks good to me.

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Thank you!

> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only
> ---
>  include/linux/uprobes.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
> index dbaf04189548..c684a470477f 100644
> --- a/include/linux/uprobes.h
> +++ b/include/linux/uprobes.h
> @@ -73,6 +73,9 @@ enum uprobe_task_state {
>  struct uprobe_task {
>  	enum uprobe_task_state		state;
>  
> +	unsigned int			depth;
> +	struct return_instance		*return_instances;
> +
>  	union {
>  		struct {
>  			struct arch_uprobe_task	autask;
> @@ -89,9 +92,6 @@ struct uprobe_task {
>  	unsigned long			xol_vaddr;
>  
>  	struct arch_uprobe              *auprobe;
> -
> -	struct return_instance		*return_instances;
> -	unsigned int			depth;
>  };
>  
>  struct return_consumer {
> -- 
> 2.47.0
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

      reply	other threads:[~2024-11-03  4:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01 21:13 Christophe JAILLET
2024-11-03  4:55 ` Masami Hiramatsu [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=20241103135548.0c19e1a1451e598c18d8c42f@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    /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

Powered by JetHome