From: Catalin Marinas <catalin.marinas@arm.com>
To: Ankur Arora <ankur.a.arora@oracle.com>
Cc: "Okanovic, Haris" <harisokn@amazon.com>,
"joao.m.martins@oracle.com" <joao.m.martins@oracle.com>,
"xueshuai@linux.alibaba.com" <xueshuai@linux.alibaba.com>,
"david.laight.linux@gmail.com" <david.laight.linux@gmail.com>,
"boris.ostrovsky@oracle.com" <boris.ostrovsky@oracle.com>,
"memxor@gmail.com" <memxor@gmail.com>,
"ashok.bhat@arm.com" <ashok.bhat@arm.com>,
"zhenglifeng1@huawei.com" <zhenglifeng1@huawei.com>,
"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
"cl@gentwo.org" <cl@gentwo.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"ast@kernel.org" <ast@kernel.org>,
"rdunlap@infradead.org" <rdunlap@infradead.org>,
"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
"arnd@arndb.de" <arnd@arndb.de>,
"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
"will@kernel.org" <will@kernel.org>,
"mark.rutland@arm.com" <mark.rutland@arm.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"rafael@kernel.org" <rafael@kernel.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v11 12/14] cpuidle/poll_state: Wait for need-resched via tif_need_resched_relaxed_wait()
Date: Tue, 21 Apr 2026 08:15:07 +0100 [thread overview]
Message-ID: <aecj-8In0A-G9OGN@arm.com> (raw)
In-Reply-To: <87mryxh67j.fsf@oracle.com>
On Mon, Apr 20, 2026 at 10:50:08AM -0700, Ankur Arora wrote:
> Okanovic, Haris <harisokn@amazon.com> writes:
> > On Wed, 2026-04-08 at 17:55 +0530, Ankur Arora wrote:
> >> The inner loop in poll_idle() polls over the thread_info flags,
> >> waiting to see if the thread has TIF_NEED_RESCHED set. The loop
> >> exits once the condition is met, or if the poll time limit has
> >> been exceeded.
> >>
> >> To minimize the number of instructions executed in each iteration,
> >> the time check is rate-limited. In addition, each loop iteration
> >> executes cpu_relax() which on certain platforms provides a hint to
> >> the pipeline that the loop busy-waits, allowing the processor to
> >> reduce power consumption.
> >>
> >> Switch over to tif_need_resched_relaxed_wait() instead, since that
> >> provides exactly that.
> >>
> >> However, since we want to minimize power consumption in idle, building
> >> of cpuidle/poll_state.c continues to depend on CONFIG_ARCH_HAS_CPU_RELAX
> >> as that serves as an indicator that the platform supports an optimized
> >> version of tif_need_resched_relaxed_wait() (via
> >> smp_cond_load_acquire_timeout()).
> >>
> >> Cc: Rafael J. Wysocki <rafael@kernel.org>
> >> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> >> Cc: linux-pm@vger.kernel.org
> >> Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
> >> Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
> >> Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
[...]
> > Tested atop latest mainline d60bc1401 with the rest of your haltpoll
> > changes from separate thread: ~10% improvement in `perf sched bench
> > pipe` micro and ~4-6% throughput improvements in mysql, postgresql,
> > cassandra, and memcached in under-loaded configurations. Tested on
> > AWS Graviton3 and Graviton4, ARM Neoverse V1 and V2 cores
> > respectively.
> >
> > I hope this series can merge soon. It's been stuck in review for more
> > than 2 years.
> >
> > Tested-by: Haris Okanovic <harisokn@amazon.com>
>
> Thanks Haris. Yeah, I don't think there are any open issues left on
> this.
I agree, though an ack from the atomic infrastructure people on the
generic bits would be nice.
--
Catalin
next prev parent reply other threads:[~2026-04-21 7:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 12:25 [PATCH v11 00/14] barrier: Add smp_cond_load_{relaxed,acquire}_timeout() Ankur Arora
2026-04-08 12:25 ` [PATCH v11 01/14] asm-generic: barrier: Add smp_cond_load_relaxed_timeout() Ankur Arora
2026-04-08 12:25 ` [PATCH v11 02/14] arm64: barrier: Support smp_cond_load_relaxed_timeout() Ankur Arora
2026-04-08 12:25 ` [PATCH v11 03/14] arm64/delay: move some constants out to a separate header Ankur Arora
2026-04-08 12:25 ` [PATCH v11 04/14] arm64: support WFET in smp_cond_load_relaxed_timeout() Ankur Arora
2026-04-08 12:25 ` [PATCH v11 05/14] arm64: rqspinlock: Remove private copy of smp_cond_load_acquire_timewait() Ankur Arora
2026-04-08 12:25 ` [PATCH v11 06/14] asm-generic: barrier: Add smp_cond_load_acquire_timeout() Ankur Arora
2026-04-08 12:25 ` [PATCH v11 07/14] atomic: Add atomic_cond_read_*_timeout() Ankur Arora
2026-04-08 12:25 ` [PATCH v11 08/14] locking/atomic: scripts: build atomic_long_cond_read_*_timeout() Ankur Arora
2026-04-08 12:25 ` [PATCH v11 09/14] bpf/rqspinlock: switch check_timeout() to a clock interface Ankur Arora
2026-04-08 12:25 ` [PATCH v11 10/14] bpf/rqspinlock: Use smp_cond_load_acquire_timeout() Ankur Arora
2026-04-08 12:25 ` [PATCH v11 11/14] sched: add need-resched timed wait interface Ankur Arora
2026-04-08 12:25 ` [PATCH v11 12/14] cpuidle/poll_state: Wait for need-resched via tif_need_resched_relaxed_wait() Ankur Arora
2026-04-20 16:57 ` Okanovic, Haris
2026-04-20 17:50 ` Ankur Arora
2026-04-21 7:15 ` Catalin Marinas [this message]
2026-04-20 22:12 ` Christoph Lameter (Ampere)
2026-04-08 12:25 ` [PATCH v11 13/14] kunit: enable testing smp_cond_load_relaxed_timeout() Ankur Arora
2026-04-08 12:25 ` [PATCH v11 14/14] kunit: add tests for smp_cond_load_relaxed_timeout() Ankur Arora
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=aecj-8In0A-G9OGN@arm.com \
--to=catalin.marinas@arm.com \
--cc=akpm@linux-foundation.org \
--cc=ankur.a.arora@oracle.com \
--cc=arnd@arndb.de \
--cc=ashok.bhat@arm.com \
--cc=ast@kernel.org \
--cc=boris.ostrovsky@oracle.com \
--cc=bpf@vger.kernel.org \
--cc=cl@gentwo.org \
--cc=daniel.lezcano@linaro.org \
--cc=david.laight.linux@gmail.com \
--cc=harisokn@amazon.com \
--cc=joao.m.martins@oracle.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=memxor@gmail.com \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=rdunlap@infradead.org \
--cc=will@kernel.org \
--cc=xueshuai@linux.alibaba.com \
--cc=zhenglifeng1@huawei.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