From: Hugh Dickins Date: Thu, 20 Dec 2012 01:42:16 +0000 (-0800) Subject: sched: numa: ksm: fix oops in task_numa_placment() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2832bc19f6668fd00116f61f821105040599ef8b;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git sched: numa: ksm: fix oops in task_numa_placment() task_numa_placement() oopsed on NULL p->mm when task_numa_fault() got called in the handling of break_ksm() for ksmd. That might be a peculiar case, which perhaps KSM could takes steps to avoid? but it's more robust if task_numa_placement() allows for such a possibility. Signed-off-by: Hugh Dickins Acked-by: Mel Gorman Signed-off-by: Linus Torvalds --- diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 4603d6cb9e25..5eea8707234a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -793,8 +793,11 @@ unsigned int sysctl_numa_balancing_scan_delay = 1000; static void task_numa_placement(struct task_struct *p) { - int seq = ACCESS_ONCE(p->mm->numa_scan_seq); + int seq; + if (!p->mm) /* for example, ksmd faulting in a user's mm */ + return; + seq = ACCESS_ONCE(p->mm->numa_scan_seq); if (p->numa_scan_seq == seq) return; p->numa_scan_seq = seq;