linux-stable/include/trace
Carlos Galo 72ba14deb4 mm: update mark_victim tracepoints fields
The current implementation of the mark_victim tracepoint provides only the
process ID (pid) of the victim process.  This limitation poses challenges
for userspace tools requiring real-time OOM analysis and intervention. 
Although this information is available from the kernel logs, it’s not
the appropriate format to provide OOM notifications.  In Android, BPF
programs are used with the mark_victim trace events to notify userspace of
an OOM kill.  For consistency, update the trace event to include the same
information about the OOMed victim as the kernel logs.

- UID
   In Android each installed application has a unique UID. Including
   the `uid` assists in correlating OOM events with specific apps.

- Process Name (comm)
   Enables identification of the affected process.

- OOM Score
  Will allow userspace to get additional insight of the relative kill
  priority of the OOM victim. In Android, the oom_score_adj is used to
  categorize app state (foreground, background, etc.), which aids in
  analyzing user-perceptible impacts of OOM events [1].

- Total VM, RSS Stats, and pgtables
  Amount of memory used by the victim that will, potentially, be freed up
  by killing it.

[1] 246dc8fc95:frameworks/base/services/core/java/com/android/server/am/ProcessList.java;l=188-283
Signed-off-by: Carlos Galo <carlosgalo@google.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-03-04 17:01:16 -08:00
..
events mm: update mark_victim tracepoints fields 2024-03-04 17:01:16 -08:00
misc NFSD: add CB_RECALL_ANY tracepoints 2022-12-10 11:01:12 -05:00
stages tracing: Error if a trace event has an array for a __field() 2023-04-03 11:52:51 -04:00
bpf_probe.h kernel.h: split out COUNT_ARGS() and CONCATENATE() to args.h 2023-08-18 10:18:56 -07:00
define_custom_trace.h tracing: Add TRACE_CUSTOM_EVENT() macro 2022-03-11 11:49:24 -05:00
define_trace.h
perf.h perf/tracing: Use stage6 of tracing to not duplicate macros 2023-01-25 10:31:24 -05:00
syscall.h
trace_custom_events.h tracing: Rename the staging files for trace_events 2022-04-02 08:40:04 -04:00
trace_events.h tracing: Rename the staging files for trace_events 2022-04-02 08:40:04 -04:00