From: sashiko-bot@kernel.org
To: "Usama Arif" <usama.arif@linux.dev>, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 3/3] perf/core: Don't zero perf_sample_data in do_perf_sw_event()
Date: Thu, 19 Nov 2026 21:19:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-224088@kernel.org> (raw)
In-Reply-To: <20261119211235.99805-4-usama.arif@linux.dev>
> Kernels built with CONFIG_INIT_STACK_ALL_ZERO, the default when the
> compiler supports it, clear every local variable on function entry. For
> the 256-byte struct perf_sample_data in do_perf_sw_event() that is a
> memset, and it runs on every entry, before the list of events is even
> looked up.
>
> do_perf_sw_event() is entered for a software event, e.g. a context
> switch, as soon as one event of that kind is open anywhere in the
> system. Counting events add to event->count and never read the struct.
> For every matching event, perf_sample_data_init() resets sample_flags,
> period and dyn_size and stores the address if there is one; for a
> sampling event, perf_prepare_sample() then fills in what its
> sample_type asks for.
>
> A single context-switch counter, e.g. one kept open by a monitoring
> [ ... ]
> this cuts the time they add to a context switch from 54 ns to 44 ns
> (sched_yield() between two threads on one CPU, with
> spec_rstack_overflow=off).
>
> Signed-off-by: Usama Arif <usama.arif@linux.dev>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119211235.99805-1-usama.arif@linux.dev?part=3
prev parent reply other threads:[~2026-11-19 21:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 21:10 [PATCH 0/3] perf/core: Fix software event sample data, then stop zeroing it Usama Arif
2026-11-19 21:10 ` [PATCH 1/3] perf/core: Fix perf_sample_data reuse across software events Usama Arif
2026-11-19 21:16 ` sashiko-bot
2026-11-19 21:10 ` [PATCH 2/3] perf/core: Don't let BPF programs read an uninitialized sample address Usama Arif
2026-11-19 21:18 ` sashiko-bot
2026-11-19 21:10 ` [PATCH 3/3] perf/core: Don't zero perf_sample_data in do_perf_sw_event() Usama Arif
2026-11-19 21:19 ` sashiko-bot [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=sashiko-outbox-224088@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=usama.arif@linux.dev \
/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