linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] HRTICK reprogramming and optimization
@ 2021-02-08  7:35 Juri Lelli
  2021-02-08  7:35 ` [PATCH 1/2] sched/features: Fix hrtick reprogramming Juri Lelli
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Juri Lelli @ 2021-02-08  7:35 UTC (permalink / raw)
  To: peterz, mingo, vincent.guittot, tglx
  Cc: linux-kernel, rostedt, dietmar.eggemann, bristot, bsegall,
	mgorman, lgoncalv, williams, Juri Lelli

Hi All,

Hung tasks and RCU stall cases were reported on systems which were not
100% busy. Investigation of such unexpected cases (no sign of potential
starvation caused by tasks hogging the system) pointed out that the
periodic sched tick timer wasn't serviced anymore after a certain point
and that caused all machinery that depends on it (timers, RCU, etc.) to
stop working as well. This issue was however only reproducible if HRTICK
was enabled.

Looking at core dumps it was found that the rbtree of the hrtimer base
used also for the hrtick was corrupted (i.e. next as seen from the base
root and actual leftmost obtained by traversing the tree are different).
Same base is also used for periodic tick hrtimer, which might get "lost"
if the rbtree gets corrupted.

Much alike what is described in commit 1f71addd34f4c ("tick/sched: Do
not mess with an enqueued hrtimer") there is infact a race window
between hrtimer_set_expires() in hrtick_start and
hrtimer_start_expires() in __hrtick_restart() in which the former might
be operating on an already queued hrtick hrtimer, which might lead to
corruption of the base. Patch 01/02 fixes this case.

While at it, it might be desired to avoid HRTICK overhead in cases where
it is only actually used to service a specific subset of scheduling
classes (currently it services both fair and deadline “at once”). Patch
02/02 proposes an optimization by making HRTICK feature selectable on a
per class basis, so one can, say, enable it only to service DEADLINE and
leave NORMAL task preemption points less fine grained.

Series available at

https://github.com/jlelli/linux.git sched/hrtick-fixes

Hope they both make sense. Comments, questions and suggestions are more
than welcome.

Best,
Juri

Juri Lelli (2):
  sched/features: Fix hrtick reprogramming
  sched/features: Distinguish between NORMAL and DEADLINE hrtick

 kernel/sched/core.c     | 10 ++++------
 kernel/sched/deadline.c |  4 ++--
 kernel/sched/fair.c     |  4 ++--
 kernel/sched/features.h |  1 +
 kernel/sched/sched.h    | 27 +++++++++++++++++++++++++--
 5 files changed, 34 insertions(+), 12 deletions(-)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-02-17 13:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08  7:35 [PATCH 0/2] HRTICK reprogramming and optimization Juri Lelli
2021-02-08  7:35 ` [PATCH 1/2] sched/features: Fix hrtick reprogramming Juri Lelli
2021-02-10 13:53   ` [tip: sched/core] " tip-bot2 for Juri Lelli
2021-02-17 13:17   ` tip-bot2 for Juri Lelli
2021-02-08  7:35 ` [PATCH 2/2] sched/features: Distinguish between NORMAL and DEADLINE hrtick Juri Lelli
2021-02-10 13:53   ` [tip: sched/core] " tip-bot2 for Juri Lelli
2021-02-17 13:17   ` tip-bot2 for Juri Lelli
2021-02-08 12:22 ` [PATCH 0/2] HRTICK reprogramming and optimization Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).