Re: [PATCH 1/2] mm, vmscan: prevent kswapd livelock due to pfmemalloc-throttled process being killed

From: Michal Hocko
Date: Fri Dec 19 2014 - 10:57:54 EST


On Fri 19-12-14 14:01:55, Vlastimil Babka wrote:
> Charles Shirron and Paul Cassella from Cray Inc have reported kswapd stuck
> in a busy loop with nothing left to balance, but kswapd_try_to_sleep() failing
> to sleep. Their analysis found the cause to be a combination of several
> factors:
>
> 1. A process is waiting in throttle_direct_reclaim() on pgdat->pfmemalloc_wait
>
> 2. The process has been killed (by OOM in this case), but has not yet been
> scheduled to remove itself from the waitqueue and die.

pfmemalloc_wait is used as wait_event and that one uses
autoremove_wake_function for wake ups so the task shouldn't stay on the
queue if it was woken up. Moreover pfmemalloc_wait sleeps are killable
by the OOM killer AFAICS.

$ git grep "wait_event.*pfmemalloc_wait"
mm/vmscan.c:
wait_event_interruptible_timeout(pgdat->pfmemalloc_wait,
mm/vmscan.c: wait_event_killable(zone->zone_pgdat->pfmemalloc_wait,))

So OOM killer would wake it up already and kswapd shouldn't see this
task on the waitqueue anymore.
--
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/