From: Chuyi Zhou <zhouchuyi@bytedance.com>
To: hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev,
ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
muchun.song@linux.dev
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
wuyun.abel@bytedance.com, robin.lu@bytedance.com,
Chuyi Zhou <zhouchuyi@bytedance.com>,
Alan Maguire <alan.maguire@oracle.com>
Subject: [RFC PATCH v2 3/5] mm: Add a tracepoint when OOM victim selection is failed
Date: Thu, 10 Aug 2023 16:13:17 +0800 [thread overview]
Message-ID: <20230810081319.65668-4-zhouchuyi@bytedance.com> (raw)
In-Reply-To: <20230810081319.65668-1-zhouchuyi@bytedance.com>
This patch add a tracepoint to mark the scenario where nothing was
chosen for OOM killer. This would allow BPF programs to catch the fact
that the BPF OOM policy didn't work well.
Suggested-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
---
include/trace/events/oom.h | 18 ++++++++++++++++++
mm/oom_kill.c | 1 +
2 files changed, 19 insertions(+)
diff --git a/include/trace/events/oom.h b/include/trace/events/oom.h
index 26a11e4a2c36..b6ae1134229c 100644
--- a/include/trace/events/oom.h
+++ b/include/trace/events/oom.h
@@ -6,6 +6,7 @@
#define _TRACE_OOM_H
#include <linux/tracepoint.h>
#include <trace/events/mmflags.h>
+#include <linux/oom.h>
TRACE_EVENT(oom_score_adj_update,
@@ -151,6 +152,23 @@ TRACE_EVENT(skip_task_reaping,
TP_printk("pid=%d", __entry->pid)
);
+TRACE_EVENT(select_bad_process_end,
+
+ TP_PROTO(struct oom_control *oc),
+
+ TP_ARGS(oc),
+
+ TP_STRUCT__entry(
+ __array(char, policy_name, POLICY_NAME_LEN)
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->policy_name, oc->policy_name, POLICY_NAME_LEN);
+ ),
+
+ TP_printk("policy_name=%s", __entry->policy_name)
+);
+
#ifdef CONFIG_COMPACTION
TRACE_EVENT(compact_retry,
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 3239dcdba4d7..af40a1b750fa 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -1235,6 +1235,7 @@ bool out_of_memory(struct oom_control *oc)
select_bad_process(oc);
/* Found nothing?!?! */
if (!oc->chosen) {
+ trace_select_bad_process_end(oc);
dump_header(oc, NULL);
pr_warn("Out of memory and no killable processes...\n");
/*
--
2.20.1
next prev parent reply other threads:[~2023-08-10 8:13 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-10 8:13 [RFC PATCH v2 0/5] mm: Select victim using bpf_oom_evaluate_task Chuyi Zhou
2023-08-10 8:13 ` [RFC PATCH v2 1/5] mm, oom: Introduce bpf_oom_evaluate_task Chuyi Zhou
2023-08-17 2:07 ` Alexei Starovoitov
2023-08-17 2:51 ` Chuyi Zhou
2023-08-17 3:22 ` Alexei Starovoitov
2023-08-18 3:30 ` Chuyi Zhou
2023-08-18 4:34 ` Alexei Starovoitov
2023-08-22 10:39 ` Michal Hocko
2023-09-13 1:18 ` Bixuan Cui
2023-09-13 8:00 ` Chuyi Zhou
2023-09-13 11:24 ` Bixuan Cui
2023-08-10 8:13 ` [RFC PATCH v2 2/5] mm: Add policy_name to identify OOM policies Chuyi Zhou
2023-08-14 20:51 ` Jonathan Corbet
2023-08-15 2:28 ` Chuyi Zhou
2023-09-14 12:02 ` Bixuan Cui
2023-09-14 12:50 ` [External] " Chuyi Zhou
2023-09-15 2:28 ` Bixuan Cui
2023-09-15 3:31 ` Chuyi Zhou
2023-09-14 12:04 ` Bixuan Cui
2023-08-10 8:13 ` Chuyi Zhou [this message]
2023-08-16 11:54 ` [RFC PATCH v2 3/5] mm: Add a tracepoint when OOM victim selection is failed Alan Maguire
2023-08-10 8:13 ` [RFC PATCH v2 4/5] bpf: Add a OOM policy test Chuyi Zhou
2023-08-16 11:53 ` Alan Maguire
2023-08-16 12:31 ` Chuyi Zhou
2023-08-16 13:49 ` Alan Maguire
2023-08-16 14:34 ` Chuyi Zhou
2023-09-28 11:35 ` Charlley Green
2023-09-13 7:55 ` Bixuan Cui
2023-08-10 8:13 ` [RFC PATCH v2 5/5] bpf: Add a BPF OOM policy Doc Chuyi Zhou
2023-08-16 15:49 ` [PATCH RFC v2 0/5] mm: Select victim using bpf_oom_evaluate_task Yosry Ahmed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230810081319.65668-4-zhouchuyi@bytedance.com \
--to=zhouchuyi@bytedance.com \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=robin.lu@bytedance.com \
--cc=roman.gushchin@linux.dev \
--cc=wuyun.abel@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox