[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdXttS3mkA+BNC69e6MYniRyGtR2vde35BYgBZ_+SuYs_Q@mail.gmail.com>
Date: Tue, 23 May 2023 09:29:53 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: David Laight <David.Laight@...lab.com>
Cc: Tony Lindgren <tony@...mide.com>, Stephen Boyd <sboyd@...nel.org>,
Tomasz Figa <tomasz.figa@...il.com>,
Sylwester Nawrocki <s.nawrocki@...sung.com>,
Will Deacon <will@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Dejin Zheng <zhengdejin5@...il.com>,
Kai-Heng Feng <kai.heng.feng@...onical.com>,
Nicholas Piggin <npiggin@...il.com>,
Heiko Carstens <hca@...ux.ibm.com>,
Peter Zijlstra <peterz@...radead.org>,
Russell King <linux@...linux.org.uk>,
John Stultz <jstultz@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Krzysztof Kozlowski <krzk@...nel.org>,
Tero Kristo <tero.kristo@...ux.intel.com>,
Ulf Hansson <ulf.hansson@...aro.org>,
"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-renesas-soc@...r.kernel.org"
<linux-renesas-soc@...r.kernel.org>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/2] iopoll: Call cpu_relax() in busy loops
Hi David,
On Thu, May 11, 2023 at 12:49 PM David Laight <David.Laight@...lab.com> wrote:
> > * Geert Uytterhoeven <geert+renesas@...der.be> [230510 13:23]:
> > > It is considered good practice to call cpu_relax() in busy loops, see
> > > Documentation/process/volatile-considered-harmful.rst. This can not
> > > only lower CPU power consumption or yield to a hyperthreaded twin
> > > processor, but also allows an architecture to mitigate hardware issues
> > > (e.g. ARM Erratum 754327 for Cortex-A9 prior to r2p0) in the
> > > architecture-specific cpu_relax() implementation.
>
> Don't you also need to call cond_resched() (at least some times).
> Otherwise the process can't be pre-empted and a RT process
> that last ran on that cpu will never be scheduled.
According to [1], cond_resched() must be called at least once per few
tens of milliseconds.
read_poll_timeout() uses usleep_range(), which calls schedule_hrtimeout_range().
read_poll_timeout_atomic() should not be used with multi-ms timeouts anyway.
So I guess we're OK?
[1] https://elixir.bootlin.com/linux/latest/source/Documentation/RCU/Design/Requirements/Requirements.rst#L2348
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists