From: Hui Su <sh_def@163.com>
To: 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, linux-kernel@vger.kernel.org,
Hui Su <sh_def@163.com>
Subject: [PATCH] sched/idle: Destroy on-stack hrtimer in play_idle_precise()
Date: Thu, 15 Oct 2026 11:50:28 +0900 [thread overview]
Message-ID: <20261015025029.3356060-1-sh_def@163.com> (raw)
play_idle_precise() initializes it.timer with hrtimer_setup_on_stack(),
but does not call destroy_hrtimer_on_stack() before the stack object
goes out of scope.
With CONFIG_DEBUG_OBJECTS_TIMERS, hrtimer_setup_on_stack() registers the
timer as an on-stack debug object. Such objects must be removed before
leaving the function which allocated them.
Call destroy_hrtimer_on_stack() after the expiry loop to balance the
on-stack timer lifetime.
Fixes: c1de45ca831a ("sched/idle: Add support for tasks that inject idle")
Signed-off-by: Hui Su <sh_def@163.com>
---
Tested on x86_64 combined candidate tree:
- hrtimer setup/free oracle: PASS (127/127 and 129/129)
- bzImage and modules build: PASS
- Branch-specific validation after split: NOT RUN
kernel/sched/idle.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index eb73b65ce6c4..96adec3f0a6d 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -436,6 +436,7 @@ void play_idle_precise(u64 duration_ns, u64 latency_ns)
while (!READ_ONCE(it.done))
do_idle();
+ destroy_hrtimer_on_stack(&it.timer);
cpuidle_use_deepest_state(0);
current->flags &= ~PF_IDLE;
base-commit: 0fcb05b72344f40806cbe810de8872f1698bf053
next reply other threads:[~2026-10-15 2:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 2:50 Hui Su [this message]
2026-10-15 7:02 ` Peter Zijlstra
2026-10-15 7:19 ` K Prateek Nayak
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=20261015025029.3356060-1-sh_def@163.com \
--to=sh_def@163.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.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=rostedt@goodmis.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®