From: Nam Cao <namcao@linutronix.de>
To: Gabriele Monaco <gmonaco@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] rv: Fix wrong type cast in monitors_show()
Date: Mon, 28 Jul 2025 11:36:10 +0200 [thread overview]
Message-ID: <20250728092756.C8zMlJtT@linutronix.de> (raw)
In-Reply-To: <786688d8a5ab0d5228d271861416d49cc3a8ebc3.camel@redhat.com>
On Mon, Jul 28, 2025 at 10:59:01AM +0200, Gabriele Monaco wrote:
> Good catch, thanks! The container_of is the way to go.
> Do you have valid reasons not to move the list_head to the top? It's
> not a big deal but it would save computing and summing the offset. It
> doesn't seem name (the current first element) really needs to stay
> there.
I checked x86_64 and riscv64, the generated assembly of this function
before & after moving the list_head on top is almost the same except for
some instructions' intermediate values. Both architectures have
instructions which load data at (pointer + offset), so this offset
computing does not require any extra instruction.
Best regards,
Nam
next prev parent reply other threads:[~2025-07-28 9:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-27 17:31 [PATCH 0/2] rv: Fix wrong type cast Nam Cao
2025-07-27 17:31 ` [PATCH 1/2] rv: Fix wrong type cast in monitors_show() Nam Cao
2025-07-28 8:59 ` Gabriele Monaco
2025-07-28 9:36 ` Nam Cao [this message]
2025-07-28 11:07 ` Gabriele Monaco
2025-07-27 17:31 ` [PATCH 2/2] rv: Fix wrong type cast in reactors_show() and monitor_reactor_show() Nam Cao
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=20250728092756.C8zMlJtT@linutronix.de \
--to=namcao@linutronix.de \
--cc=gmonaco@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.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