mm, vmstat: fix wrong WQ sleep when memory reclaim doesn't make any progress
authorTetsuo Handa <>
Fri, 5 Feb 2016 23:36:30 +0000 (15:36 -0800)
committerBen Hutchings <>
Sat, 27 Feb 2016 14:28:47 +0000 (14:28 +0000)
commit 564e81a57f9788b1475127012e0fd44e9049e342 upstream.

Jan Stancek has reported that system occasionally hanging after "oom01"
testcase from LTP triggers OOM.  Guessing from a result that there is a
kworker thread doing memory allocation and the values between "Node 0
Normal free:" and "Node 0 Normal:" differs when hanging, vmstat is not
up-to-date for some reason.

According to commit 373ccbe59270 ("mm, vmstat: allow WQ concurrency to
discover memory reclaim doesn't make any progress"), it meant to force
the kworker thread to take a short sleep, but it by error used
schedule_timeout(1).  We missed that schedule_timeout() in state
TASK_RUNNING doesn't do anything.

Fix it by using schedule_timeout_uninterruptible(1) which forces the
kworker thread to take a short sleep in order to make sure that vmstat
is up-to-date.

Fixes: 373ccbe59270 ("mm, vmstat: allow WQ concurrency to discover memory reclaim doesn't make any progress")
Signed-off-by: Tetsuo Handa <>
Reported-by: Jan Stancek <>
Acked-by: Michal Hocko <>
Cc: Tejun Heo <>
Cc: Cristopher Lameter <>
Cc: Joonsoo Kim <>
Cc: Arkadiusz Miskiewicz <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
Signed-off-by: Ben Hutchings <>

index 17f5403..845e58b 100644 (file)
@@ -879,7 +879,7 @@ long wait_iff_congested(struct zone *zone, int sync, long timeout)
                 * here rather than calling cond_resched().
                if (current->flags & PF_WQ_WORKER)
-                       schedule_timeout(1);
+                       schedule_timeout_uninterruptible(1);