summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0208-printk-Drop-the-logbuf_lock-more-often.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:38 +0000
commit08b74a000942a380fe028845f92cd3a0dee827d5 (patch)
treeaa78b4e12607c3e1fcce8d5cc42df4330792f118 /debian/patches-rt/0208-printk-Drop-the-logbuf_lock-more-often.patch
parentAdding upstream version 4.19.249. (diff)
downloadlinux-08b74a000942a380fe028845f92cd3a0dee827d5.tar.xz
linux-08b74a000942a380fe028845f92cd3a0dee827d5.zip
Adding debian version 4.19.249-2.debian/4.19.249-2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0208-printk-Drop-the-logbuf_lock-more-often.patch')
-rw-r--r--debian/patches-rt/0208-printk-Drop-the-logbuf_lock-more-often.patch83
1 files changed, 83 insertions, 0 deletions
diff --git a/debian/patches-rt/0208-printk-Drop-the-logbuf_lock-more-often.patch b/debian/patches-rt/0208-printk-Drop-the-logbuf_lock-more-often.patch
new file mode 100644
index 000000000..bc4f44f50
--- /dev/null
+++ b/debian/patches-rt/0208-printk-Drop-the-logbuf_lock-more-often.patch
@@ -0,0 +1,83 @@
+From b4bf7654e00cd7da0d18577698e25eb199de2d57 Mon Sep 17 00:00:00 2001
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Thu, 21 Mar 2013 19:01:05 +0100
+Subject: [PATCH 208/347] printk: Drop the logbuf_lock more often
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz
+
+The lock is hold with irgs off. The latency drops 500us+ on my arm bugs
+with a "full" buffer after executing "dmesg" on the shell.
+
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ kernel/printk/printk.c | 28 ++++++++++++++++++++++++++++
+ 1 file changed, 28 insertions(+)
+
+diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
+index 273f2c7864b5..1e0988a0bb97 100644
+--- a/kernel/printk/printk.c
++++ b/kernel/printk/printk.c
+@@ -1457,12 +1457,23 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
+ u64 next_seq;
+ u64 seq;
+ u32 idx;
++ int attempts = 0;
++ int num_msg;
+
+ text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL);
+ if (!text)
+ return -ENOMEM;
+
+ logbuf_lock_irq();
++
++try_again:
++ attempts++;
++ if (attempts > 10) {
++ len = -EBUSY;
++ goto out;
++ }
++ num_msg = 0;
++
+ /*
+ * Find first record that fits, including all following records,
+ * into the user-provided buffer for this dump.
+@@ -1475,6 +1486,14 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
+ len += msg_print_text(msg, true, NULL, 0);
+ idx = log_next(idx);
+ seq++;
++ num_msg++;
++ if (num_msg > 5) {
++ num_msg = 0;
++ logbuf_unlock_irq();
++ logbuf_lock_irq();
++ if (clear_seq < log_first_seq)
++ goto try_again;
++ }
+ }
+
+ /* move first record forward until length fits into the buffer */
+@@ -1486,6 +1505,14 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
+ len -= msg_print_text(msg, true, NULL, 0);
+ idx = log_next(idx);
+ seq++;
++ num_msg++;
++ if (num_msg > 5) {
++ num_msg = 0;
++ logbuf_unlock_irq();
++ logbuf_lock_irq();
++ if (clear_seq < log_first_seq)
++ goto try_again;
++ }
+ }
+
+ /* last message fitting into this dump */
+@@ -1523,6 +1550,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
+ clear_seq = log_next_seq;
+ clear_idx = log_next_idx;
+ }
++out:
+ logbuf_unlock_irq();
+
+ kfree(text);
+--
+2.36.1
+