blob: e29c07252c4194f9e3d1a6ba7615a4de02266005 [file] [log] [blame]
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 24 Aug 2020 15:26:04 -0400
4Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
5 (v5.9)
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10See upstream commit:
11
12 commit 27bc446e2def38db3244a6eb4bb1d6312936610a
13 Author: brookxu <brookxu.cn@gmail.com>
14 Date: Mon Aug 17 15:36:15 2020 +0800
15
16 ext4: limit the length of per-inode prealloc list
17
18 In the scenario of writing sparse files, the per-inode prealloc list may
19 be very long, resulting in high overhead for ext4_mb_use_preallocated().
20 To circumvent this problem, we limit the maximum length of per-inode
21 prealloc list to 512 and allow users to modify it.
22
23 After patching, we observed that the sys ratio of cpu has dropped, and
24 the system throughput has increased significantly. We created a process
25 to write the sparse file, and the running time of the process on the
26 fixed kernel was significantly reduced, as follows:
27
28 Running time on unfixed kernel
29 [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
30 real 0m2.051s
31 user 0m0.008s
32 sys 0m2.026s
33
34 Running time on fixed kernel
35 [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
36 real 0m0.471s
37 user 0m0.004s
38 sys 0m0.395s
39
40Upstream-Status: Backport
41
42Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
43Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
44Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
45---
46 instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
47 1 file changed, 15 insertions(+)
48
49diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
50index 5f7ab28..72ad4c9 100644
51--- a/instrumentation/events/lttng-module/ext4.h
52+++ b/instrumentation/events/lttng-module/ext4.h
53@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
54 )
55 #endif
56
57+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
58+LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
59+ TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
60+
61+ TP_ARGS(inode, len, needed),
62+
63+ TP_FIELDS(
64+ ctf_integer(dev_t, dev, inode->i_sb->s_dev)
65+ ctf_integer(ino_t, ino, inode->i_ino)
66+ ctf_integer(unsigned int, len, len)
67+ ctf_integer(unsigned int, needed, needed)
68+ )
69+)
70+#else
71 LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
72 TP_PROTO(struct inode *inode),
73
74@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
75 ctf_integer(ino_t, ino, inode->i_ino)
76 )
77 )
78+#endif
79
80 LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
81 TP_PROTO(struct super_block *sb, int needed),
82--
832.19.1
84