lkml.org 
[lkml]   [2016]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: zone_reclaimable() leads to livelock in __alloc_pages_slowpath()
From
Date
On 2016/05/21 5:28, Oleg Nesterov wrote:
> Hello,
>
> Recently I hit the problem, _sometimes_ the system just hangs in OOM situation.
> Surprisingly, this time OOM-killer is innocent ;) and finally I can reproduce
> this more-or-less reliably just running
>
> #include <stdlib.h>
> #include <string.h>
>
> int main(void)
> {
> for (;;) {
> void *p = malloc(1024 * 1024);
> memset(p, 0, 1024 * 1024);
> }
> }
>
> in a loop on the otherwise idle system. 512m RAM, one CPU (but CONFIG_SMP=y),
> no swap, and only one user-space process (apart from test-case above), /bin/sh
> runnning as init with pid==1. I am attaching my .config just in case, but I
> think the problem is not really specific to this configuration.
>
> --------------------------------------------------------------------------------
> It spins in __alloc_pages_slowpath() forever, __alloc_pages_may_oom() is never
> called, it doesn't react to SIGKILL, etc.
>
> This is because zone_reclaimable() is always true in shrink_zones(), and the
> problem goes away if I comment out this code
>
> if (global_reclaim(sc) &&
> !reclaimable && zone_reclaimable(zone))
> reclaimable = true;
>
> in shrink_zones() which otherwise returns this "true" every time, and thus
> __alloc_pages_slowpath() always sees did_some_progress != 0.
>

Michal Hocko's OOM detection rework patchset that removes that code was sent
to Linus 4 hours ago. ( https://marc.info/?l=linux-mm-commits&m=146378862415399 )
Please wait for a few days and try reproducing using linux.git .

\
 
 \ /
  Last update: 2016-05-21 06:41    [W:0.690 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site