From: Karl Mehltretter <kmehltretter@gmail.com>
To: Thomas Gleixner <tglx@kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Cc: Anna-Maria Behnsen <anna-maria@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Andy Lutomirski <luto@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hrtimer: Use the mask to clear TIF_HRTIMER_REARM from the exit work
Date: Mon, 28 Sep 2026 06:01:15 +0200 [thread overview]
Message-ID: <arnmPC3_rbXgy48W@gmail.com> (raw)
In-Reply-To: <20260919144027.70250-1-kmehltretter@gmail.com>
On Sat, Sep 19, 2026 at 04:40:27PM +0100, Karl Mehltretter wrote:
> TIF_HRTIMER_REARM is the bit number (12), not the mask. That clears
> TIF_NOTIFY_SIGNAL (bit 2) and TIF_MEMDIE (bit 3) from the copy and
> leaves bit 12 set.
>
> So the function never returns true, and the copy handed to
> exit_to_user_mode_loop() lacks TIF_NOTIFY_SIGNAL. If that was the only
> work for the loop, the task returns to user space with the task work
> still pending. hrtimer_interrupt() sets TIF_HRTIMER_REARM every time,
> so the next tick repeats that. Task work queued with TWA_SIGNAL from a
> hrtimer callback stays pending until the task does a syscall, takes an
> interrupt without deferred rearm or has to reschedule.
>
> A task which polls the io_uring completion ring in user space sees a
> timeout completion after 30ms (median) instead of 70us. 2 CPU QEMU
> guest, HZ=1000.
>
> Use the mask.
The patch also fixes longer delays I found with NO_HZ_FULL.
Same 2-CPU x86-64 QEMU guest, nohz_full=1 rcu_nocbs=1, polling on
CPU 1. For 6,000 3 ms timeouts per kernel across three boots:
More than 50 ms late Worst delay
Unpatched 239 (4%) 991 ms
Patched 0 5.7 ms
Most callbacks run on the housekeeping CPU and avoid the bug. A
traced local expiry was followed by a 737 ms gap until a
call-function IPI.
Thanks,
Karl
next prev parent reply other threads:[~2026-09-28 4:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 14:40 Karl Mehltretter
2026-09-28 4:01 ` Karl Mehltretter [this message]
2026-09-29 21:43 ` [tip: timers/urgent] " tip-bot2 for Karl Mehltretter
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=arnmPC3_rbXgy48W@gmail.com \
--to=kmehltretter@gmail.com \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@kernel.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
all inboxes | Powered by JetHome®