Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ec07046 authored by Patrick Daly's avatar Patrick Daly
Browse files

mm/oom_kill: Disable scary messages for normal usecases



As the oom-killer is allowed to run (in rare situations only!) when
CONFIG_HAVE_USERSPACE_LOW_MEMORY_KILLER=y, disable dumping the
system memory state when the oom-killer kills a task.

Change-Id: I26965c0c8588721f0908202c4a9d67d26af1d704
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent fec352ad
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -972,11 +972,12 @@ static void __oom_kill_process(struct task_struct *victim)
	 */
	do_send_sig_info(SIGKILL, SEND_SIG_FORCED, victim, PIDTYPE_TGID);
	mark_oom_victim(victim);
	pr_err("Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB\n",
	pr_err("Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB oom_score_adj=%hd\n",
		task_pid_nr(victim), victim->comm, K(victim->mm->total_vm),
		K(get_mm_counter(victim->mm, MM_ANONPAGES)),
		K(get_mm_counter(victim->mm, MM_FILEPAGES)),
		K(get_mm_counter(victim->mm, MM_SHMEMPAGES)));
		K(get_mm_counter(victim->mm, MM_SHMEMPAGES)),
		p->signal->oom_score_adj);
	task_unlock(victim);

	/*
@@ -1034,7 +1035,8 @@ static int oom_kill_memcg_member(struct task_struct *task, void *unused)
	return 0;
}

static void oom_kill_process(struct oom_control *oc, const char *message)
static void oom_kill_process(struct oom_control *oc, const char *message,
				bool quiet)
{
	struct task_struct *p = oc->chosen;
	unsigned int points = oc->chosen_points;
@@ -1061,7 +1063,7 @@ static void oom_kill_process(struct oom_control *oc, const char *message)
	}
	task_unlock(p);

	if (__ratelimit(&oom_rs))
	if (!quiet && __ratelimit(&oom_rs))
		dump_header(oc, p);

	pr_err("%s: Kill process %d (%s) score %u or sacrifice child\n",
@@ -1226,7 +1228,8 @@ bool out_of_memory(struct oom_control *oc)
	    current->signal->oom_score_adj != OOM_SCORE_ADJ_MIN) {
		get_task_struct(current);
		oc->chosen = current;
		oom_kill_process(oc, "Out of memory (oom_kill_allocating_task)");
		oom_kill_process(oc, "Out of memory (oom_kill_allocating_task)",
				 false);
		return true;
	}

@@ -1245,7 +1248,8 @@ bool out_of_memory(struct oom_control *oc)
	}
	if (oc->chosen && oc->chosen != (void *)-1UL)
		oom_kill_process(oc, !is_memcg_oom(oc) ? "Out of memory" :
				 "Memory cgroup out of memory");
				 "Memory cgroup out of memory",
			IS_ENABLED(CONFIG_HAVE_USERSPACE_LOW_MEMORY_KILLER));
	return !!oc->chosen;
}