summaryrefslogtreecommitdiff
path: root/kernel/time/timekeeping.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-03-21 12:25:58 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-17 11:35:39 +0200
commita23607579f12bc792fa4327544775afe428ac826 (patch)
tree7a5aec35a4edbc5d8a8846fdd9e10db13f2bc8a2 /kernel/time/timekeeping.h
parent22d7ec50ffdd49288b17a52f7fe2312e9dbd0390 (diff)
downloadlinux-a23607579f12bc792fa4327544775afe428ac826.tar.gz
linux-a23607579f12bc792fa4327544775afe428ac826.tar.bz2
linux-a23607579f12bc792fa4327544775afe428ac826.zip
timekeeping: Split jiffies seqlock
[ Upstream commit e5d4d1756b07d9490a0269a9e68c1e05ee1feb9b ] 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>
Diffstat (limited to 'kernel/time/timekeeping.h')
-rw-r--r--kernel/time/timekeeping.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/time/timekeeping.h b/kernel/time/timekeeping.h
index 141ab3ab0354..099737f6f10c 100644
--- a/kernel/time/timekeeping.h
+++ b/kernel/time/timekeeping.h
@@ -25,7 +25,8 @@ static inline void sched_clock_resume(void) { }
extern void do_timer(unsigned long ticks);
extern void update_wall_time(void);
-extern seqlock_t jiffies_lock;
+extern raw_spinlock_t jiffies_lock;
+extern seqcount_t jiffies_seq;
#define CS_NAME_LEN 32