• Tetsuo Handa's avatar
    mm, vmstat: fix wrong WQ sleep when memory reclaim doesn't make any progress · 564e81a5
    Tetsuo Handa authored
    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 373ccbe5 ("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: 373ccbe5 ("mm, vmstat: allow WQ concurrency to discover memory reclaim doesn't make any progress")
    Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Reported-by: default avatarJan Stancek <jstancek@redhat.com>
    Acked-by: default avatarMichal Hocko <mhocko@suse.com>
    Cc: Tejun Heo <tj@kernel.org>
    Cc: Cristopher Lameter <clameter@sgi.com>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: Arkadiusz Miskiewicz <arekm@maven.pl>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    564e81a5
backing-dev.c 26.4 KB