summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2026-09-14 16:34:12 +0200
committerPetr Mladek <pmladek@suse.com>2026-09-29 16:06:20 +0200
commit731383dcf511c4d9ee00b3dc9f4f65689e233401 (patch)
tree735495ffd967af7b549dafa198aa0847f5a22fb0 /tools/lib/python
parent72d907f23ef092d63caac96ca3af6fcae4506008 (diff)
downloadlinux-next-731383dcf511c4d9ee00b3dc9f4f65689e233401.tar.gz
linux-next-731383dcf511c4d9ee00b3dc9f4f65689e233401.zip
printk: Use two irq_works instead per-CPU
In commit b845b517b5e37 ("printk: robustify printk") initially got its delayed wake up which is today implemented via the irq_work. Back then it was a variable which was assigned to 1 if a pending wake up was waiting. This variable was checked on each timer tick. Therefore it makes sense to assign a per-CPU variable with this task to avoid cache line bouncing when each CPU reads the variable on each timer tick simultaneously. Today we have a irq_work which is enqueued onto a list and handled if it has work items assigned. This list is already per-CPU. We could replace the per-CPU irq_work and the per-CPU printk_pending with two irq_work structs: One for PRINTK_PENDING_WAKEUP and the other for PRINTK_PENDING_OUTPUT. While unrolling the conditions in __wake_up_klogd() it becomes obvious that PRINTK_PENDING_WAKEUP is always passed as an argument but never checked. The return value wq_has_sleeper() of does not really matter it's sole purpose is to enforce the needed memory barrier. Redo the irq_work by: - Use one irq_work (pending_wakeup_work) for klogd wakes. Schedule it only if there is a sleeper waiting. - Use one irq_work (&pending_output_work) for output printing. Schedule it only if PRINTK_PENDING_OUTPUT passed. - Drop unused PRINTK_PENDING_WAKEUP. - Remove the preempt_disable() section. Its purpose was to ensure that printk_pending and wake_up_klogd_work is accessed from the same CPU. Worst case is defer_console_output() where two irq_work are scheduled but those get processed one after the other during the HZ tick so it shouldn't get worse. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> Reviewed-by: John Ogness <john.ogness@linutronix.de> Link: https://patch.msgid.link/20260914143412.1sMcp89V@linutronix.de Signed-off-by: Petr Mladek <pmladek@suse.com>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions