summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng/lttng-modules/0003-Fix-mm_compaction_migratepages-changed-in-linux-6.9-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/lttng/lttng-modules/0003-Fix-mm_compaction_migratepages-changed-in-linux-6.9-.patch')
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0003-Fix-mm_compaction_migratepages-changed-in-linux-6.9-.patch81
1 files changed, 81 insertions, 0 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-Fix-mm_compaction_migratepages-changed-in-linux-6.9-.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-Fix-mm_compaction_migratepages-changed-in-linux-6.9-.patch
new file mode 100644
index 0000000000..66c48ebe8f
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0003-Fix-mm_compaction_migratepages-changed-in-linux-6.9-.patch
@@ -0,0 +1,81 @@
1From f4a6415f8d5fa447868d1fdc7119e0a328966379 Mon Sep 17 00:00:00 2001
2From: Kienan Stewart <kstewart@efficios.com>
3Date: Mon, 25 Mar 2024 10:30:32 -0400
4Subject: [PATCH 3/4] Fix: mm_compaction_migratepages changed in linux 6.9-rc1
5
6See upstream commit:
7
8 commit ab755bf4249b992fc2140d615ab0a686d50765b4
9 Author: Baolin Wang <baolin.wang@linux.alibaba.com>
10 Date: Tue Feb 20 14:16:31 2024 +0800
11
12 mm: compaction: update the cc->nr_migratepages when allocating or freeing the freepages
13
14 Currently we will use 'cc->nr_freepages >= cc->nr_migratepages' comparison
15 to ensure that enough freepages are isolated in isolate_freepages(),
16 however it just decreases the cc->nr_freepages without updating
17 cc->nr_migratepages in compaction_alloc(), which will waste more CPU
18 cycles and cause too many freepages to be isolated.
19
20 So we should also update the cc->nr_migratepages when allocating or
21 freeing the freepages to avoid isolating excess freepages. And I can see
22 fewer free pages are scanned and isolated when running thpcompact on my
23 Arm64 server:
24
25 k6.7 k6.7_patched
26 Ops Compaction pages isolated 120692036.00 118160797.00
27 Ops Compaction migrate scanned 131210329.00 154093268.00
28 Ops Compaction free scanned 1090587971.00 1080632536.00
29 Ops Compact scan efficiency 12.03 14.26
30
31 Moreover, I did not see an obvious latency improvements, this is likely
32 because isolating freepages is not the bottleneck in the thpcompact test
33 case.
34
35 k6.7 k6.7_patched
36 Amean fault-both-1 1089.76 ( 0.00%) 1080.16 * 0.88%*
37 Amean fault-both-3 1616.48 ( 0.00%) 1636.65 * -1.25%*
38 Amean fault-both-5 2266.66 ( 0.00%) 2219.20 * 2.09%*
39 Amean fault-both-7 2909.84 ( 0.00%) 2801.90 * 3.71%*
40 Amean fault-both-12 4861.26 ( 0.00%) 4733.25 * 2.63%*
41 Amean fault-both-18 7351.11 ( 0.00%) 6950.51 * 5.45%*
42 Amean fault-both-24 9059.30 ( 0.00%) 9159.99 * -1.11%*
43 Amean fault-both-30 10685.68 ( 0.00%) 11399.02 * -6.68%*
44
45Upstream-Status: Backport [175fe77c Fix: mm_compaction_migratepages changed in linux 6.9-rc1]
46
47Change-Id: I103a43fd1b549360b3fc978fd409b7c17ef3e192
48Signed-off-by: Kienan Stewart <kstewart@efficios.com>
49Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
50---
51 include/instrumentation/events/compaction.h | 17 ++++++++++++++++-
52 1 file changed, 16 insertions(+), 1 deletion(-)
53
54Index: lttng-modules-2.13.12/include/instrumentation/events/compaction.h
55===================================================================
56--- lttng-modules-2.13.12.orig/include/instrumentation/events/compaction.h
57+++ lttng-modules-2.13.12/include/instrumentation/events/compaction.h
58@@ -97,7 +97,22 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(comp
59
60 #endif /* #else #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0) */
61
62-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0) || \
63+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,9,0))
64+LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
65+
66+ compaction_migratepages,
67+
68+ TP_PROTO(unsigned int nr_migratepages,
69+ unsigned int nr_succeeded),
70+
71+ TP_ARGS(nr_migratepages, nr_succeeded),
72+
73+ TP_FIELDS(
74+ ctf_integer(unsigned long, nr_migrated, nr_succeeded)
75+ ctf_integer(unsigned long, nr_failed, nr_migratepages - nr_succeeded)
76+ )
77+)
78+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0) || \
79 LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0))
80 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
81