X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;f=mm%2Fmemcontrol.c;h=0f870ba43942e74d1d535a13437e446da5863b1a;hb=89a2848381b5fcd9c4d9c0cd97680e3b28730e31;hp=ae052b5e3315217874569d0c1cf57ade9cea99a1;hpb=8f72cb4ef90c63bcb5111c2e3ec7ea2727eab2f8;p=cascardo%2Flinux.git diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ae052b5e3315..0f870ba43942 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1917,6 +1917,15 @@ retry: current->flags & PF_EXITING)) goto force; + /* + * Prevent unbounded recursion when reclaim operations need to + * allocate memory. This might exceed the limits temporarily, + * but we prefer facilitating memory reclaim and getting back + * under the limit over triggering OOM kills in these cases. + */ + if (unlikely(current->flags & PF_MEMALLOC)) + goto force; + if (unlikely(task_in_memcg_oom(current))) goto nomem;