Re: [PATCH] Add the memcg print oom info for system oom
From: David Rientjes
Date: Tue May 22 2018 - 18:00:13 EST
On Tue, 22 May 2018, Michal Hocko wrote:
> > I've had success with defining a single line output the includes the
> > CONSTRAINT_* of the oom kill, the origin and kill memcgs, the thread name,
> > pid, and uid. On system oom kills, origin and kill memcgs are left empty.
> >
> > oom-kill constraint=CONSTRAINT_* origin_memcg=<memcg> kill_memcg=<memcg> task=<comm> pid=<pid> uid=<uid>
> >
> > Perhaps we should introduce a single line output that will be backwards
> > compatible that includes this information?
>
> I do not have a strong preference here. We already print cpuset on its
> own line and we can do the same for the memcg.
>
Yes, for both the memcg that has reached its limit (origin_memcg) and the
memcg the killed process is attached to (kill_memcg).
It's beneficial to have a single-line output to avoid any printk
interleaving or ratelimiting that includes the constraint, comm, and at
least pid. (We include uid simply to find oom kills of root processes.)
We already have all this information, including cpuset, cpuset nodemask,
and allocation nodemask for mempolicy ooms. The only exception appears to
be the kill_memcg for CONSTRAINT_NONE and for it to be emitted in a way
that can't be interleaved or suppressed.
Perhaps we can have this?
oom-kill constraint=CONSTRAINT_* nodemask=<cpuset/mempolicy nodemask> origin_memcg=<memcg> kill_memcg=<memcg> task=<comm> pid=<pid> uid=<uid>
For CONSTRAINT_NONE, nodemask and origin_memcg are empty. For
CONSTRAINT_CPUSET and CONSTRAINT_MEMORY_POLICY, origin_memcg is empty.