diff options
author | Ahmed S. Darwish <a.darwish@linutronix.de> | 2020-09-04 17:32:30 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2020-09-10 11:19:31 +0200 |
commit | 8117ab508f9c476e0a10b9db7f4818f784cf3176 (patch) | |
tree | 26a710128669d4b84fec5e0548274597ba9732e9 /tools/perf/scripts/python/exported-sql-viewer.py | |
parent | 52ac39e5db5148f70392edb654ad882ac8da88a8 (diff) |
seqlock: seqcount_LOCKNAME_t: Introduce PREEMPT_RT support
Preemption must be disabled before entering a sequence counter write
side critical section. Otherwise the read side section can preempt the
write side section and spin for the entire scheduler tick. If that
reader belongs to a real-time scheduling class, it can spin forever and
the kernel will livelock.
Disabling preemption cannot be done for PREEMPT_RT though: it can lead
to higher latencies, and the write side sections will not be able to
acquire locks which become sleeping locks (e.g. spinlock_t).
To remain preemptible, while avoiding a possible livelock caused by the
reader preempting the writer, use a different technique: let the reader
detect if a seqcount_LOCKNAME_t writer is in progress. If that's the
case, acquire then release the associated LOCKNAME writer serialization
lock. This will allow any possibly-preempted writer to make progress
until the end of its writer serialization lock critical section.
Implement this lock-unlock technique for all seqcount_LOCKNAME_t with
an associated (PREEMPT_RT) sleeping lock.
References: 55f3560df975 ("seqlock: Extend seqcount API with associated locks")
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200519214547.352050-1-a.darwish@linutronix.de
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions