]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
mm: memcg: handle non-error OOM situations more gracefully
authorJohannes Weiner <hannes@cmpxchg.org>
Wed, 16 Oct 2013 20:46:59 +0000 (13:46 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 17 Oct 2013 04:35:53 +0000 (21:35 -0700)
commit4942642080ea82d99ab5b653abb9a12b7ba31f4a
tree7ec12b61f0bfdd1f1466e5233b67432828b25c33
parentc88b05b2cd07221cdefd56f7f7422c1459eb60c9
mm: memcg: handle non-error OOM situations more gracefully

Commit 3812c8c8f395 ("mm: memcg: do not trap chargers with full
callstack on OOM") assumed that only a few places that can trigger a
memcg OOM situation do not return VM_FAULT_OOM, like optional page cache
readahead.  But there are many more and it's impractical to annotate
them all.

First of all, we don't want to invoke the OOM killer when the failed
allocation is gracefully handled, so defer the actual kill to the end of
the fault handling as well.  This simplifies the code quite a bit for
added bonus.

Second, since a failed allocation might not be the abrupt end of the
fault, the memcg OOM handler needs to be re-entrant until the fault
finishes for subsequent allocation attempts.  If an allocation is
attempted after the task already OOMed, allow it to bypass the limit so
that it can quickly finish the fault and invoke the OOM killer.

Reported-by: azurIt <azurit@pobox.sk>
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/memcontrol.h
include/linux/sched.h
mm/filemap.c
mm/memcontrol.c
mm/memory.c
mm/oom_kill.c