From: Hui Su <sh_def@163.com>
To: anna-maria@linutronix.de, frederic@kernel.org, tglx@kernel.org,
mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org
Cc: dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
kprateek.nayak@amd.com, rafael.j.wysocki@intel.com,
jacob.jun.pan@linux.intel.com, linux-kernel@vger.kernel.org,
Hui Su <sh_def@163.com>
Subject: [PATCH v2 0/2] hrtimer: Add cleanup class for on-stack timers
Date: Fri, 16 Oct 2026 10:09:42 +0900 [thread overview]
Message-ID: <cover.1792083743.git.sh_def@163.com> (raw)
Add an opt-in cleanup class that pairs hrtimer_setup_on_stack() with
destroy_hrtimer_on_stack(), and convert play_idle_precise() to use it.
The class provides debug-object teardown, not timer cancellation. The
converted caller limits the cleanup object's lifetime to the block covering
timer start and the idle wait, which ends only after the pinned hard hrtimer
callback has completed.
Testing:
- x86_64 QEMU with CONFIG_DEBUG_OBJECTS_TIMERS=y: baseline setup=301,
play_idle_precise return=301, free=0; the patched kernel recorded
setup=301, play_idle_precise return=301, free=301 for the same timer
address, with no ODEBUG warning.
- x86_64 GCC 15.2.0: the series built bzImage/modules, and
kernel/sched/idle.o also built with CONFIG_DEBUG_OBJECTS_TIMERS=n.
Changes in v2:
- Add an hrtimer_on_stack cleanup class following Peter's suggestion to use
__cleanup() for the setup/destroy pairing.
- Document the hrtimer_setup_on_stack() lifetime requirements.
- Convert play_idle_precise() using CLASS() in an explicit block and explain
the callback ordering.
v1: https://lore.kernel.org/lkml/20261015025029.3356060-1-sh_def@163.com/
Hui Su (2):
hrtimer: Add cleanup class for on-stack timers
sched/idle: Use hrtimer cleanup class in play_idle_precise()
include/linux/hrtimer.h | 24 ++++++++++++++++++++++++
kernel/sched/idle.c | 16 ++++++++++------
kernel/time/hrtimer.c | 8 ++++++--
3 files changed, 40 insertions(+), 8 deletions(-)
base-commit: 0fcb05b72344f40806cbe810de8872f1698bf053
--
2.55.0
next reply other threads:[~2026-10-16 1:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 1:09 Hui Su [this message]
2026-10-16 1:09 ` [PATCH v2 1/2] " Hui Su
2026-10-16 1:09 ` [PATCH v2 2/2] sched/idle: Use hrtimer cleanup class in play_idle_precise() Hui Su
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=cover.1792083743.git.sh_def@163.com \
--to=sh_def@163.com \
--cc=anna-maria@linutronix.de \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=frederic@kernel.org \
--cc=jacob.jun.pan@linux.intel.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rostedt@goodmis.org \
--cc=tglx@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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®