]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.34/tty-increase-the-default-flip-buffer-limit-to-2-640k.patch
Linux 4.19.34
[thirdparty/kernel/stable-queue.git] / releases / 4.19.34 / tty-increase-the-default-flip-buffer-limit-to-2-640k.patch
CommitLineData
ba172962
SL
1From 36ebe625e05239c105f8c3d6f0c00305314e41a2 Mon Sep 17 00:00:00 2001
2From: Manfred Schlaegl <manfred.schlaegl@ginzinger.com>
3Date: Mon, 28 Jan 2019 19:01:10 +0100
4Subject: tty: increase the default flip buffer limit to 2*640K
5
6[ Upstream commit 7ab57b76ebf632bf2231ccabe26bea33868118c6 ]
7
8We increase the default limit for buffer memory allocation by a factor of
910 to 640K to prevent data loss when using fast serial interfaces.
10
11For example when using RS485 without flow-control at speeds of 1Mbit/s
12an upwards we've run into problems such as applications being too slow
13to read out this buffer (on embedded devices based on imx53 or imx6).
14
15If you want to write transmitted data to a slow SD card and thus have
16realtime requirements, this limit can become a problem.
17
18That shouldn't be the case and 640K buffers fix such problems for us.
19
20This value is a maximum limit for allocation only. It has no effect
21on systems that currently run fine. When transmission is slow enough
22applications and hardware can keep up and increasing this limit
23doesn't change anything.
24
25It only _allows_ to allocate more than 2*64K in cases we currently fail to
26allocate memory despite having some.
27
28Signed-off-by: Manfred Schlaegl <manfred.schlaegl@ginzinger.com>
29Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
30Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
31Signed-off-by: Sasha Levin <sashal@kernel.org>
32---
33 drivers/tty/tty_buffer.c | 2 +-
34 1 file changed, 1 insertion(+), 1 deletion(-)
35
36diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
37index ae3ce330200e..ee3aa57bc0e7 100644
38--- a/drivers/tty/tty_buffer.c
39+++ b/drivers/tty/tty_buffer.c
40@@ -26,7 +26,7 @@
41 * Byte threshold to limit memory consumption for flip buffers.
42 * The actual memory limit is > 2x this amount.
43 */
44-#define TTYB_DEFAULT_MEM_LIMIT 65536
45+#define TTYB_DEFAULT_MEM_LIMIT (640 * 1024UL)
46
47 /*
48 * We default to dicing tty buffer allocations to this many characters
49--
502.19.1
51