Re: [patch 1/2] mm, memcg: avoid oom notification when current needsaccess to memory reserves

From: Johannes Weiner
Date: Tue Dec 03 2013 - 22:35:06 EST


On Tue, Dec 03, 2013 at 03:50:41PM -0800, David Rientjes wrote:
> On Tue, 3 Dec 2013, Michal Hocko wrote:
>
> > OK, as it seems that the notification part is too controversial, how
> > would you like the following? It reverts the notification part and still
> > solves the fault on exit path. I will prepare the full patch with the
> > changelog if this looks reasonable:
>
> Um, no, that's not satisfactory because it obviously does the check after
> mem_cgroup_oom_notify(). There is absolutely no reason why userspace
> should be woken up when current simply needs access to memory reserves to
> exit. You can already get such notification by memory thresholds at the
> memcg limit.
>
> I'll repeat: Section 10 of Documentation/cgroups/memory.txt specifies what
> userspace should do when waking up; one of those options is not "check if
> the memcg is still actually oom in a short period of time once a charging
> task with a pending SIGKILL or in the exit path has been able to exit."
> Users of this interface typically also disable the memcg oom killer
> through the same file, it's ludicrous to put the responsibility on
> userspace to determine if the wakeup is actionable and requires it to
> intervene in one of the methods listed in section 10.

Kind of a bummer that you haven't read anything I wrote...

But here is a patch that defers wakeups until we know for sure that
userspace action is required:

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f1a0ae6..cc6adac 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2254,8 +2254,17 @@ bool mem_cgroup_oom_synchronize(bool handle)

locked = mem_cgroup_oom_trylock(memcg);

+#if 0
+ /*
+ * XXX: An unrelated task in the group might exit at any time,
+ * making the OOM kill unnecessary. We don't want to wake up
+ * the userspace handler unless we are certain it needs to
+ * intervene, so disable notifications until we solve the
+ * halting problem.
+ */
if (locked)
mem_cgroup_oom_notify(memcg);
+#endif

if (locked && !memcg->oom_kill_disable) {
mem_cgroup_unmark_under_oom(memcg);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/