linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Gautam Menghani <gautammenghani201@gmail.com>
Cc: akpm@linux-foundation.org, mhiramat@kernel.org,
	shy828301@gmail.com, zokeefe@google.com, david@redhat.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] mm/khugepaged: add tracepoint to collapse_file()
Date: Mon, 14 Nov 2022 10:33:50 -0500	[thread overview]
Message-ID: <20221114103350.4b8a2786@gandalf.local.home> (raw)
In-Reply-To: <20221026052218.148234-1-gautammenghani201@gmail.com>

On Wed, 26 Oct 2022 10:52:18 +0530
Gautam Menghani <gautammenghani201@gmail.com> wrote:

Ideally we want the trace event structure to be as packed as possible to
not waste space on the ring buffer.

> +	TP_ARGS(mm, hpage, index, is_shmem, addr, file, nr, result),
> +	TP_STRUCT__entry(
> +		__field(struct mm_struct *, mm)  4 / 8 bytes (depending on 32 bit or 64 bit arch)
> +		__field(unsigned long, hpfn)     4 / 8 bytes

The two above is fine.

> +		__field(pgoff_t, index)         4 / 8 bytes
> +		__field(bool, is_shmem)         4 bytes (or less)

> +		__field(unsigned long, addr)    4 / 8 bytes

> +		__string(filename, file->f_path.dentry->d_iname)  4 bytes
> +		__field(int, nr)		4 bytes
> +		__field(int, result)		4 bytes

For best packing, it's best to keep long / pointers together, and ints and
bools together (or paired).

On 64 bit archs, there is likely to be a 4 byte hole between is_shmem and
addr.

> +	),
> +

Better to have it be:


	TP_STRUCT__entry(
		__field(struct mm_struct *, mm)
		__field(unsigned long, hpfn)
		__field(pgoff_t, index)
		__field(unsigned long, addr)
		__field(bool, is_shmem)
		__string(filename, file->f_path.dentry->d_iname)
		__field(int, nr)
		__field(int, result)
	),

Where I swapped is_shmem and addr.

-- Steve


      reply	other threads:[~2022-11-14 15:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  5:22 Gautam Menghani
2022-11-14 15:33 ` Steven Rostedt [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=20221114103350.4b8a2786@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=gautammenghani201@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhiramat@kernel.org \
    --cc=shy828301@gmail.com \
    --cc=zokeefe@google.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