On Tue, 27 Oct 2026 17:40:13 +0800
Xuewen Wang <[email protected]> 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>