linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: ratelimit oversized kvmalloc warnings instead of once
@ 2024-06-18 21:34 Shakeel Butt
  2024-06-18 21:40 ` Linus Torvalds
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Shakeel Butt @ 2024-06-18 21:34 UTC (permalink / raw)
  To: Andrew Morton, Michal Hocko
  Cc: Linus Torvalds, kernel-team, linux-mm, linux-kernel, Kyle McMartin

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.

Reported-by: Kyle McMartin <kyle@infradead.org>
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
---
 mm/util.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/util.c b/mm/util.c
index 10f215985fe5..de36344e8d53 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -649,7 +649,8 @@ void *kvmalloc_node_noprof(size_t size, gfp_t flags, int node)
 
 	/* Don't even allow crazy sizes */
 	if (unlikely(size > INT_MAX)) {
-		WARN_ON_ONCE(!(flags & __GFP_NOWARN));
+		WARN_RATELIMIT(!(flags & __GFP_NOWARN), "size = %zu > INT_MAX",
+			       size);
 		return NULL;
 	}
 
-- 
2.43.0



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-06-19 19:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-18 21:34 [PATCH] mm: ratelimit oversized kvmalloc warnings instead of once 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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox