+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
IN mm/oom_kill.c
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1. mm/oom_kill.c – out_of_memory() – MAIN ENTRY POINT
void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order, nodemask_t *nodemask)
{
printk(KERN_INFO “[OOM_TRACE] === OOM KILLER ACTIVATED ===\n”);
printk(KERN_INFO “[OOM_TRACE] out_of_memory() order=%d, gfp=0x%x\n”, order, gfp_mask);
// … existing code …
}
2. mm/oom_kill.c – select_bad_process() – VICTIM SELECTION
static struct task_struct *select_bad_process(unsigned int *ppoints,
unsigned long totalpages,
struct mem_cgroup *mem,
const nodemask_t *nodemask)
{
printk(KERN_INFO “[OOM_TRACE] select_bad_process() – searching for victim\n”);
// … existing code …
// At the end before return:
if (chosen) {
printk(KERN_INFO “[OOM_TRACE] Victim selected: %s (PID %d) score=%u\n”,
chosen->comm, chosen->pid, *ppoints);
}
return chosen;
}
3. mm/oom_kill.c – oom_kill_process() – ACTUAL KILLING
static void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
unsigned int points, unsigned long totalpages,
struct mem_cgroup *mem, nodemask_t *nodemask,
const char *message)
{
printk(KERN_INFO “[OOM_TRACE] oom_kill_process() killing %s (PID %d)\n”, p->comm, p->pid);
printk(KERN_INFO “[OOM_TRACE] Reason: %s\n”, message);
// … existing code …
}
4. mm/oom_kill.c – oom_kill_task() – SENDING SIGKILL
static int oom_kill_task(struct task_struct *p)
{
printk(KERN_INFO “[OOM_TRACE] oom_kill_task() sending SIGKILL to %s (PID %d)\n”,
p->comm, p->pid);
// … existing code …
// After force_sig(SIGKILL, p):
printk(KERN_INFO “[OOM_TRACE] SIGKILL sent to %s (PID %d)\n”, p->comm, p->pid);
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
IN kernel/signal.c
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1. kernel/signal.c – force_sig() – FORCED SIGNAL DELIVERY
int force_sig(int sig, struct task_struct *p)
{
if (sig == SIGKILL) {
printk(KERN_INFO “[OOM_TRACE] force_sig(SIGKILL) to %s (PID %d)\n”, p->comm, p->pid);
}
// … existing code …
}
2. kernel/signal.c – force_sig_info() – DETAILED SIGNAL INFOv
int force_sig_info(int sig, struct siginfo *info, struct task_struct *t)
{
if (sig == SIGKILL) {
printk(KERN_INFO “[OOM_TRACE] force_sig_info(SIGKILL) to %s (PID %d)\n”, t->comm, t->pid);
}
// … existing code …
}
3. kernel/signal.c – do_send_sig_info() – SIGNAL SENDING
int do_send_sig_info(int sig, struct siginfo *info, struct task_struct *p, bool group)
{
if (sig == SIGKILL) {
printk(KERN_INFO “[OOM_TRACE] do_send_sig_info(SIGKILL) to %s (PID %d)\n”, p->comm, p->pid);
}
// … existing code …
}