summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch')
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
new file mode 100644
index 0000000000..e29c07252c
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
@@ -0,0 +1,84 @@
+From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Mon, 24 Aug 2020 15:26:04 -0400
+Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
+ (v5.9)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+See upstream commit:
+
+ commit 27bc446e2def38db3244a6eb4bb1d6312936610a
+ Author: brookxu <brookxu.cn@gmail.com>
+ Date: Mon Aug 17 15:36:15 2020 +0800
+
+ ext4: limit the length of per-inode prealloc list
+
+ In the scenario of writing sparse files, the per-inode prealloc list may
+ be very long, resulting in high overhead for ext4_mb_use_preallocated().
+ To circumvent this problem, we limit the maximum length of per-inode
+ prealloc list to 512 and allow users to modify it.
+
+ After patching, we observed that the sys ratio of cpu has dropped, and
+ the system throughput has increased significantly. We created a process
+ to write the sparse file, and the running time of the process on the
+ fixed kernel was significantly reduced, as follows:
+
+ Running time on unfixed kernel:
+ [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
+ real 0m2.051s
+ user 0m0.008s
+ sys 0m2.026s
+
+ Running time on fixed kernel:
+ [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
+ real 0m0.471s
+ user 0m0.004s
+ sys 0m0.395s
+
+Upstream-Status: Backport
+
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
+---
+ instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
+index 5f7ab28..72ad4c9 100644
+--- a/instrumentation/events/lttng-module/ext4.h
++++ b/instrumentation/events/lttng-module/ext4.h
+@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
+ )
+ #endif
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
++LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
++ TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
++
++ TP_ARGS(inode, len, needed),
++
++ TP_FIELDS(
++ ctf_integer(dev_t, dev, inode->i_sb->s_dev)
++ ctf_integer(ino_t, ino, inode->i_ino)
++ ctf_integer(unsigned int, len, len)
++ ctf_integer(unsigned int, needed, needed)
++ )
++)
++#else
+ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
+ TP_PROTO(struct inode *inode),
+
+@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
+ ctf_integer(ino_t, ino, inode->i_ino)
+ )
+ )
++#endif
+
+ LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
+ TP_PROTO(struct super_block *sb, int needed),
+--
+2.19.1
+