Re: [PATCH v3] mm: memcontrol: Don't flood OOM messages with no eligible task.
From: Michal Hocko
Date: Thu Oct 18 2018 - 02:55:24 EST
On Thu 18-10-18 11:46:50, Tetsuo Handa wrote:
> Sergey Senozhatsky wrote:
> > On (10/17/18 12:28), Michal Hocko wrote:
> > > > Michal proposed ratelimiting dump_header() [2]. But I don't think that
> > > > that patch is appropriate because that patch does not ratelimit
> > > >
> > > > "%s invoked oom-killer: gfp_mask=%#x(%pGg), nodemask=%*pbl, order=%d, oom_score_adj=%hd\n"
> > > > "Out of memory and no killable processes...\n"
> > [..]
> > > > Let's make sure that next dump_header() waits for at least 60 seconds from
> > > > previous "Out of memory and no killable processes..." message.
> > >
> > > Could you explain why this is any better than using a well established
> > > ratelimit approach?
>
> This is essentially a ratelimit approach, roughly equivalent with:
>
> static DEFINE_RATELIMIT_STATE(oom_no_victim_rs, 60 * HZ, 1);
> oom_no_victim_rs.flags |= RATELIMIT_MSG_ON_RELEASE;
>
> if (__ratelimit(&oom_no_victim_rs)) {
> dump_header(oc, NULL);
> pr_warn("Out of memory and no killable processes...\n");
> oom_no_victim_rs.begin = jiffies;
> }
Then there is no reason to reinvent the wheel. So use the standard
ratelimit approach. Or put it in other words, this place is no special
to any other that needs some sort of printk throttling. We surely do not
want an ad-hoc solutions all over the kernel.
And once you realize that the ratelimit api is the proper one (put aside
any potential improvements in the implementation of this api) then you
quickly learn that we already do throttle oom reports and it would be
nice to unify that and ... we are back to a naked patch. So please stop
being stuborn and try to cooperate finally.
--
Michal Hocko
SUSE Labs