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