mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: wangxuewen <wangxuewen@kylinos.cn>
To: Steven Rostedt <rostedt@goodmis.org>
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, wangxuewen_ky@163.com
Subject: Re: [PATCH 1/2] mm/shmem: trace swapin results and order fallbacks
Date: Fri, 30 Oct 2026 18:37:16 +0800	[thread overview]
Message-ID: <1db65746-7af3-444c-92c0-32019bbfd937@kylinos.cn> (raw)
In-Reply-To: <20261029103615.31dff835@gandalf.local.home>

Hi Steve,

Thank you for your review. I agree with you. The current field layout 
introduces padding holes on 64-bit systems. I'll rearrange the structure 
in v2, grouping long fields at the front and smaller integer fields 
after, to reduce ring buffer memory overhead.

Best regards,
Xuewen

在 2026/10/29 22:36, Steven Rostedt 写道:
> 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>


  reply	other threads:[~2026-10-30 10:37 UTC|newest]

Thread overview: 10+ 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
2026-10-30 10:37     ` wangxuewen [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
     [not found] ` <1793238664825191.108.seg@mailgw.kylinos.cn>
2026-10-30 10:28   ` wangxuewen

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=1db65746-7af3-444c-92c0-32019bbfd937@kylinos.cn \
    --to=wangxuewen@kylinos.cn \
    --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=rostedt@goodmis.org \
    --cc=skhan@linuxfoundation.org \
    --cc=wangxuewen_ky@163.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®