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

Commit 05fdda0d authored by Charan Teja Reddy's avatar Charan Teja Reddy
Browse files

lowmemorykiller: ignore the tasks that has null mm for reaping



The setting of task_struct->mm to NULL might race when the same process
gets selected in the lowmemorykiller path for reaping of memory.So,
ignore the process for reaping when its mm NULL.

Change-Id: I40a50cc2f6dea892ed9b31df7aad59a349ff8c9c
Signed-off-by: default avatarCharan Teja Reddy <charante@codeaurora.org>
parent 2467fe92
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -561,13 +561,15 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)

		task_lock(selected);
		send_sig(SIGKILL, selected, 0);
		if (selected->mm)
		if (selected->mm) {
			task_set_lmk_waiting(selected);
		if (oom_reaper)
			if (!test_bit(MMF_OOM_SKIP, &selected->mm->flags) &&
			    oom_reaper) {
				mark_lmk_victim(selected);
		task_unlock(selected);
		if (oom_reaper)
				wake_oom_reaper(selected);
			}
		}
		task_unlock(selected);
		trace_lowmemory_kill(selected, cache_size, cache_limit, free);
		lowmem_print(1, "Killing '%s' (%d) (tgid %d), adj %hd,\n"
			"to free %ldkB on behalf of '%s' (%d) because\n"