Linux Trace Kernel
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Xuewen Wang <wangxuewen@kylinos.cn>
Cc: hughd@google.com, baolin.wang@linux.alibaba.com,
	mhiramat@kernel.org, mathieu.desnoyers@efficios.com,
	corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH 1/2] mm/shmem: trace swapin results and order fallbacks
Date: Thu, 29 Oct 2026 10:36:15 -0400	[thread overview]
Message-ID: <20261029103615.31dff835@gandalf.local.home> (raw)
In-Reply-To: <20261027094014.2432692-2-wangxuewen@kylinos.cn>

On Tue, 27 Oct 2026 17:40:13 +0800
Xuewen Wang <wangxuewen@kylinos.cn> wrote:

> +TRACE_EVENT(shmem_swapin_folio,
> +
> +	TP_PROTO(struct inode *inode, pgoff_t index,
> +		 unsigned int entry_type, pgoff_t entry_offset,
> +		 int requested_order, int actual_order, unsigned int path,
> +		 unsigned int fallback, int fallback_error, int error),
> +
> +	TP_ARGS(inode, index, entry_type, entry_offset, requested_order,
> +		actual_order, path, fallback, fallback_error, error),
> +
> +	TP_STRUCT__entry(
> +		__field(dev_t, dev)
> +		__field(unsigned long, ino)
> +		__field(unsigned long, index)
> +		__field(unsigned int, entry_type)
> +		__field(unsigned long, entry_offset)
> +		__field(int, requested_order)
> +		__field(int, actual_order)
> +		__field(unsigned int, path)
> +		__field(unsigned int, fallback)
> +		__field(int, fallback_error)
> +		__field(int, error)

There's a lot of holes in the above structure.

dev_t is 4 bytes in size, which means you have a 4 byte hole between that
and the ino (on 64 bit machines).

And another 4 byte hole between entry_type and entry_offset.

Move the longs to the beginning and the ints after that. The order of the
structure isn't important for the output, but is important for saving ring
buffer space.

-- Steve

> +	),
> +
> +	TP_fast_assign(
> +		__entry->dev = inode->i_sb->s_dev;
> +		__entry->ino = inode->i_ino;
> +		__entry->index = index;
> +		__entry->entry_type = entry_type;
> +		__entry->entry_offset = entry_offset;
> +		__entry->requested_order = requested_order;
> +		__entry->actual_order = actual_order;
> +		__entry->path = path;
> +		__entry->fallback = fallback;
> +		__entry->fallback_error = fallback_error;
> +		__entry->error = error;
> +	),
> +
> +	TP_printk("dev=%d:%d ino=%lu index=%lu entry=%u:%lu requested_order=%d actual_order=%d path=%s fallback=%s fallback_error=%d error=%d",
> +		  MAJOR(__entry->dev), MINOR(__entry->dev),
> +		  __entry->ino, __entry->index,
> +		  __entry->entry_type, __entry->entry_offset,
> +		  __entry->requested_order, __entry->actual_order,
> +		  __print_symbolic(__entry->path,
> +				   { SHMEM_SWAPIN_LOOKUP, "lookup" },
> +				   { SHMEM_SWAPIN_CACHE, "cache" },
> +				   { SHMEM_SWAPIN_SYNC, "sync" },
> +				   { SHMEM_SWAPIN_READAHEAD, "readahead" },
> +				   { SHMEM_SWAPIN_POISON, "poison" }),
> +		  show_shmem_swapin_fallback(__entry->fallback),
> +		  __entry->fallback_error, __entry->error)
> +);
> +
> +#endif /* _TRACE_SHMEM_H */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>

  parent reply	other threads:[~2026-10-29 14:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27  9:40 [PATCH 0/2] mm/shmem: trace swapin results and allocation fallbacks Xuewen Wang
2026-10-27  9:40 ` [PATCH 1/2] mm/shmem: trace swapin results and order fallbacks Xuewen Wang
2026-10-27 23:55   ` Randy Dunlap
2026-10-28  3:27     ` wangxuewen
2026-10-29 14:36   ` Steven Rostedt [this message]
2026-10-27  9:40 ` [PATCH 2/2] mm/shmem: trace folio allocation failures and fallbacks Xuewen Wang
2026-10-29 14:38   ` Steven Rostedt
2026-10-28  7:56 ` [PATCH 0/2] mm/shmem: trace swapin results and allocation fallbacks Baolin Wang

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=20261029103615.31dff835@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=corbet@lwn.net \
    --cc=hughd@google.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --cc=wangxuewen@kylinos.cn \
    /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