mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-07 03:18:31 +00:00
memcg, oom: notify on oom killer invocation from the charge path
commit7056d3a37d
upstream. Burt Holzman has noticed that memcg v1 doesn't notify about OOM events via eventfd anymore. The reason is that29ef680ae7
("memcg, oom: move out_of_memory back to the charge path") has moved the oom handling back to the charge path. While doing so the notification was left behind in mem_cgroup_oom_synchronize. Fix the issue by replicating the oom hierarchy locking and the notification. Link: http://lkml.kernel.org/r/20181224091107.18354-1-mhocko@kernel.org Fixes:29ef680ae7
("memcg, oom: move out_of_memory back to the charge path") Signed-off-by: Michal Hocko <mhocko@suse.com> Reported-by: Burt Holzman <burt@fnal.gov> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Vladimir Davydov <vdavydov.dev@gmail.com Cc: <stable@vger.kernel.org> [4.19+] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8da70752f5
commit
1c5e0be35d
1 changed files with 19 additions and 3 deletions
|
@ -1666,6 +1666,9 @@ enum oom_status {
|
|||
|
||||
static enum oom_status mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int order)
|
||||
{
|
||||
enum oom_status ret;
|
||||
bool locked;
|
||||
|
||||
if (order > PAGE_ALLOC_COSTLY_ORDER)
|
||||
return OOM_SKIPPED;
|
||||
|
||||
|
@ -1698,10 +1701,23 @@ static enum oom_status mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int
|
|||
return OOM_ASYNC;
|
||||
}
|
||||
|
||||
if (mem_cgroup_out_of_memory(memcg, mask, order))
|
||||
return OOM_SUCCESS;
|
||||
mem_cgroup_mark_under_oom(memcg);
|
||||
|
||||
return OOM_FAILED;
|
||||
locked = mem_cgroup_oom_trylock(memcg);
|
||||
|
||||
if (locked)
|
||||
mem_cgroup_oom_notify(memcg);
|
||||
|
||||
mem_cgroup_unmark_under_oom(memcg);
|
||||
if (mem_cgroup_out_of_memory(memcg, mask, order))
|
||||
ret = OOM_SUCCESS;
|
||||
else
|
||||
ret = OOM_FAILED;
|
||||
|
||||
if (locked)
|
||||
mem_cgroup_oom_unlock(memcg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue