The patch titled Subject: memcg, oom: notify on oom killer invocation from the charge path has been added to the -mm tree. Its filename is memcg-oom-notify-on-oom-killer-invocation-from-the-charge-path.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/memcg-oom-notify-on-oom-killer-invocation-from-the-charge-path.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/memcg-oom-notify-on-oom-killer-invocation-from-the-charge-path.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Michal Hocko <mhocko@xxxxxxxx> Subject: memcg, oom: notify on oom killer invocation from the charge path Burt Holzman has noticed that memcg v1 doesn't notify about OOM events via eventfd anymore. The reason is that 29ef680ae7c2 ("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@xxxxxxxxxx Fixes: 29ef680ae7c2 ("memcg, oom: move out_of_memory back to the charge path") Signed-off-by: Michal Hocko <mhocko@xxxxxxxx> Reported-by: Burt Holzman <burt@xxxxxxxx> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx Cc: <stable@xxxxxxxxxxxxxxx> [4.19+] Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/mm/memcontrol.c~memcg-oom-notify-on-oom-killer-invocation-from-the-charge-path +++ a/mm/memcontrol.c @@ -1673,6 +1673,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; @@ -1707,10 +1710,23 @@ static enum oom_status mem_cgroup_oom(st return OOM_ASYNC; } + mem_cgroup_mark_under_oom(memcg); + + 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)) - return OOM_SUCCESS; + ret = OOM_SUCCESS; + else + ret = OOM_FAILED; + + if (locked) + mem_cgroup_oom_unlock(memcg); - return OOM_FAILED; + return ret; } /** _ Patches currently in -mm which might be from mhocko@xxxxxxxx are mm-memcg-fix-reclaim-deadlock-with-writeback.patch mm-print-more-information-about-mapping-in-__dump_page.patch mm-lower-the-printk-loglevel-for-__dump_page-messages.patch mm-memory_hotplug-drop-pointless-block-alignment-checks-from-__offline_pages.patch mm-memory_hotplug-print-reason-for-the-offlining-failure.patch mm-memory_hotplug-be-more-verbose-for-memory-offline-failures.patch mm-memory_hotplug-be-more-verbose-for-memory-offline-failures-update.patch mm-only-report-isolation-failures-when-offlining-memory.patch mm-memory_hotplug-do-not-clear-numa_node-association-after-hot_remove.patch hwpoison-memory_hotplug-allow-hwpoisoned-pages-to-be-offlined.patch mm-proc-be-more-verbose-about-unstable-vma-flags-in-proc-pid-smaps.patch mm-thp-proc-report-thp-eligibility-for-each-vma.patch mm-proc-report-pr_set_thp_disable-in-proc.patch mm-memory_hotplug-try-to-migrate-full-pfn-range.patch mm-memory_hotplug-deobfuscate-migration-part-of-offlining.patch mm-fault_around-do-not-take-a-reference-to-a-locked-page.patch memory_hotplug-add-missing-newlines-to-debugging-output.patch memcg-oom-notify-on-oom-killer-invocation-from-the-charge-path.patch