]> git.baikalelectronics.ru Git - kernel.git/commit
timekeeping: Split jiffies seqlock
authorThomas Gleixner <tglx@linutronix.de>
Sat, 21 Mar 2020 11:25:58 +0000 (12:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:35:39 +0000 (11:35 +0200)
commit22dd57d6f1ea0e72ae9efd992417655f7a30527f
tree7a5aec35a4edbc5d8a8846fdd9e10db13f2bc8a2
parent5716c63cb32e35a82dd27c2463b624168fc154f3
timekeeping: Split jiffies seqlock

[ Upstream commit 82d26b6dd11718c6ce88cd5449bdac6e976e849d ]

seqlock consists of a sequence counter and a spinlock_t which is used to
serialize the writers. spinlock_t is substituted by a "sleeping" spinlock
on PREEMPT_RT enabled kernels which breaks the usage in the timekeeping
code as the writers are executed in hard interrupt and therefore
non-preemptible context even on PREEMPT_RT.

The spinlock in seqlock cannot be unconditionally replaced by a
raw_spinlock_t as many seqlock users have nesting spinlock sections or
other code which is not suitable to run in truly atomic context on RT.

Instead of providing a raw_seqlock API for a single use case, open code the
seqlock for the jiffies use case and implement it with a raw_spinlock_t and
a sequence counter.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200321113242.120587764@linutronix.de
Stable-dep-of: e9523a0d8189 ("tick/common: Align tick period with the HZ tick.")
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/time/jiffies.c
kernel/time/tick-common.c
kernel/time/tick-sched.c
kernel/time/timekeeping.c
kernel/time/timekeeping.h