diff options
Diffstat (limited to 'meta/recipes-kernel/lttng/lttng-modules/0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch')
-rw-r--r-- | meta/recipes-kernel/lttng/lttng-modules/0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch new file mode 100644 index 0000000000..892d3f0d23 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0010-fix-mm-compaction-cleanup-the-compaction-trace-event.patch | |||
@@ -0,0 +1,106 @@ | |||
1 | From f9208dc00756dfa0a2f191799722030bdf3f793d Mon Sep 17 00:00:00 2001 | ||
2 | From: Michael Jeanson <mjeanson@efficios.com> | ||
3 | Date: Mon, 4 Apr 2022 15:14:01 -0400 | ||
4 | Subject: [PATCH 10/10] fix: mm: compaction: cleanup the compaction trace | ||
5 | events (v5.18) | ||
6 | |||
7 | See upstream commit : | ||
8 | |||
9 | commit abd4349ff9b8d242376b67711254221f64f447c7 | ||
10 | Author: Baolin Wang <baolin.wang@linux.alibaba.com> | ||
11 | Date: Tue Mar 22 14:45:56 2022 -0700 | ||
12 | |||
13 | mm: compaction: cleanup the compaction trace events | ||
14 | |||
15 | As Steven suggested [1], we should access the pointers from the trace | ||
16 | event to avoid dereferencing them to the tracepoint function when the | ||
17 | tracepoint is disabled. | ||
18 | |||
19 | [1] https://lkml.org/lkml/2021/11/3/409 | ||
20 | |||
21 | Upstream-Status: Backport | ||
22 | |||
23 | Change-Id: I6c08250df8596e8dbc76780ae5d95c899c12e6fe | ||
24 | Signed-off-by: Michael Jeanson <mjeanson@efficios.com> | ||
25 | Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | ||
26 | --- | ||
27 | include/instrumentation/events/compaction.h | 17 ++++++++++++++++- | ||
28 | src/probes/Kbuild | 17 ++++++++++++++++- | ||
29 | src/probes/lttng-probe-compaction.c | 5 +++++ | ||
30 | 3 files changed, 37 insertions(+), 2 deletions(-) | ||
31 | |||
32 | diff --git a/include/instrumentation/events/compaction.h b/include/instrumentation/events/compaction.h | ||
33 | index 15964537..ecae39a8 100644 | ||
34 | --- a/include/instrumentation/events/compaction.h | ||
35 | +++ b/include/instrumentation/events/compaction.h | ||
36 | @@ -97,7 +97,22 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template, | ||
37 | |||
38 | #endif /* #else #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0) */ | ||
39 | |||
40 | -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) | ||
41 | +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0)) | ||
42 | +LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages, | ||
43 | + | ||
44 | + compaction_migratepages, | ||
45 | + | ||
46 | + TP_PROTO(struct compact_control *cc, | ||
47 | + unsigned int nr_succeeded), | ||
48 | + | ||
49 | + TP_ARGS(cc, nr_succeeded), | ||
50 | + | ||
51 | + TP_FIELDS( | ||
52 | + ctf_integer(unsigned long, nr_migrated, nr_succeeded) | ||
53 | + ctf_integer(unsigned long, nr_failed, cc->nr_migratepages - nr_succeeded) | ||
54 | + ) | ||
55 | +) | ||
56 | +#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) | ||
57 | LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages, | ||
58 | |||
59 | compaction_migratepages, | ||
60 | diff --git a/src/probes/Kbuild b/src/probes/Kbuild | ||
61 | index 8d6ff0f2..54784477 100644 | ||
62 | --- a/src/probes/Kbuild | ||
63 | +++ b/src/probes/Kbuild | ||
64 | @@ -167,7 +167,22 @@ ifneq ($(CONFIG_BTRFS_FS),) | ||
65 | endif # $(wildcard $(btrfs_dep)) | ||
66 | endif # CONFIG_BTRFS_FS | ||
67 | |||
68 | -obj-$(CONFIG_LTTNG) += lttng-probe-compaction.o | ||
69 | +# A dependency on internal header 'mm/internal.h' was introduced in v5.18 | ||
70 | +compaction_dep = $(srctree)/mm/internal.h | ||
71 | +compaction_dep_wildcard = $(wildcard $(compaction_dep)) | ||
72 | +compaction_dep_check = $(shell \ | ||
73 | +if [ \( $(VERSION) -ge 6 \ | ||
74 | + -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 18 \) \) -a \ | ||
75 | + -z "$(compaction_dep_wildcard)" ] ; then \ | ||
76 | + echo "warn" ; \ | ||
77 | +else \ | ||
78 | + echo "ok" ; \ | ||
79 | +fi ;) | ||
80 | +ifeq ($(compaction_dep_check),ok) | ||
81 | + obj-$(CONFIG_LTTNG) += lttng-probe-compaction.o | ||
82 | +else | ||
83 | + $(warning Files $(compaction_dep) not found. Probe "compaction" is disabled. Use full kernel source tree to enable it.) | ||
84 | +endif # $(wildcard $(compaction_dep)) | ||
85 | |||
86 | ifneq ($(CONFIG_EXT4_FS),) | ||
87 | ext4_dep = $(srctree)/fs/ext4/*.h | ||
88 | diff --git a/src/probes/lttng-probe-compaction.c b/src/probes/lttng-probe-compaction.c | ||
89 | index f8ddf384..ffaf45f0 100644 | ||
90 | --- a/src/probes/lttng-probe-compaction.c | ||
91 | +++ b/src/probes/lttng-probe-compaction.c | ||
92 | @@ -10,6 +10,11 @@ | ||
93 | |||
94 | #include <linux/module.h> | ||
95 | #include <lttng/tracer.h> | ||
96 | +#include <lttng/kernel-version.h> | ||
97 | + | ||
98 | +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0)) | ||
99 | +#include "../mm/internal.h" | ||
100 | +#endif | ||
101 | |||
102 | /* | ||
103 | * Create the tracepoint static inlines from the kernel to validate that our | ||
104 | -- | ||
105 | 2.19.1 | ||
106 | |||