Re: [patch -mm] mm, memcg: evaluate root and leaf memcgs fairly on oom

From: David Rientjes
Date: Thu Mar 15 2018 - 16:01:42 EST


On Thu, 15 Mar 2018, Roman Gushchin wrote:

> > Seems like it was dropped from the patch somehow. It is intended to do
> > atomic_long_add(nr_pages) in mem_cgroup_charge_skmem() and
> > atomic_long_add(-nr_pages) mem_cgroup_uncharge_skmem().
> >
> > > I also doubt that global atomic variable can work here,
> > > we probably need something better scaling.
> > >
> >
> > Why do you think an atomic_long_add() is too expensive when we're already
> > disabling irqs and dong try_charge()?
>
> Hard to say without having full code :)
> try_charge() is batched, if you'll batch it too, it will probably work.
>

The full code is what's specified above: it does the
atomic_long_add(nr_pages) in mem_cgroup_charge_skmem() and
atomic_long_add(-nr_pages) mem_cgroup_uncharge_skmem().

The patch is comparing the root mem cgroup and leaf mem cgroups fairly.
For this, it requires that we have stats that can be directly compared or
at least very close approximations. We don't want to get in a situation
where root and leaf mem cgroups are being compared based on different
stats.