linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Shakeel Butt <shakeel.butt@linux.dev>
To: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	kernel-team@meta.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Kyle McMartin <kyle@infradead.org>
Subject: Re: [PATCH] mm: ratelimit oversized kvmalloc warnings instead of once
Date: Wed, 19 Jun 2024 10:47:51 -0700	[thread overview]
Message-ID: <20240619174751.7r2s7iojxbaxpqlw@linux.dev> (raw)
In-Reply-To: <ZnKbR7IOd0b6GDBI@tiehlicka>

On Wed, Jun 19, 2024 at 10:48:07AM +0200, Michal Hocko wrote:
> On Wed 19-06-24 10:30:46, Michal Hocko wrote:
> > On Wed 19-06-24 01:03:16, Shakeel Butt wrote:
> > > On Wed, Jun 19, 2024 at 09:19:41AM GMT, Michal Hocko wrote:
> > > > On Tue 18-06-24 14:34:21, Shakeel Butt wrote:
> > > > > At the moment oversize kvmalloc warnings are triggered once using
> > > > > WARN_ON_ONCE() macro. One issue with this approach is that it only
> > > > > detects the first abuser and then ignores the remaining abusers which
> > > > > complicates detecting all such abusers in a timely manner. The situation
> > > > > becomes worse when the repro has low probability and requires production
> > > > > traffic and thus require large set of machines to find such abusers. In
> > > > > Mera production, this warn once is slowing down the detection of these
> > > > > abusers. Simply replace WARN_ON_ONCE with WARN_RATELIMIT.
> > > > 
> > > > Long time ago, I've had a patch to do the once_per_callsite WARN. I
> > > > cannot find reference at the moment but it used stack depot to note
> > > > stacks that have already triggered. Back then there was no reponse on
> > > > the ML. Should I try to dig deep and recover it from my archives? I
> > > > think this is exactly kind of usecase where it would fit.
> > > > 
> > > 
> > > Do you mean something like warn once per unique call stack?
> > 
> > Exactly!
> > 
> > > If yes then
> > > I think that is better than the simple ratelimiting version as
> > > ratelimiting one may still miss some abusers and also may keep warning
> > > about the same abuser. Please do share your patch.
> > 
> > https://lore.kernel.org/all/20170103134424.28123-1-mhocko@kernel.org/
> 
> Btw. the code has changed a lot since 2017 when this was posted so it
> will likely need a lot of massaging to rebase. Also I am not entirely
> sure it is ok to change WARN_ONCE semantic like that anymore. Maybe we
> need an explicit variant that does this per-call-site warnings. It is a
> notable difference between library functions which can be called from
> different callpaths and those that are used from a single place. I do
> not have much time to dig deeper into this but if you want to take over
> then go ahead. I still think this is a useful WARN_ONCE or in general
> do_something_once semantic.

I think a separate variant like WARN_UNIQUE() would be better. I will
look into this.

Linus, please let me know if you have any concerns on the approach
Michal is suggesting i.e. a variant for warn once for unique call stack.

Shakeel


  reply	other threads:[~2024-06-19 17:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18 21:34 Shakeel Butt
2024-06-18 21:40 ` Linus Torvalds
2024-06-18 21:44   ` Shakeel Butt
2024-06-19  7:19 ` Michal Hocko
2024-06-19  8:03   ` Shakeel Butt
2024-06-19  8:30     ` Michal Hocko
2024-06-19  8:37       ` Shakeel Butt
2024-06-19  8:48       ` Michal Hocko
2024-06-19 17:47         ` Shakeel Butt [this message]
2024-06-19 19:30           ` Linus Torvalds
2024-06-19 19:54             ` Michal Hocko
2024-06-19 12:49 ` Mateusz Guzik
2024-06-19 12:51   ` Mateusz Guzik
2024-06-19 17:52   ` Shakeel Butt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240619174751.7r2s7iojxbaxpqlw@linux.dev \
    --to=shakeel.butt@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=kernel-team@meta.com \
    --cc=kyle@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox