Skip to content

Commit 1be334e

Browse files
hnaztorvalds
authored andcommitted
mm/page_alloc.c: ratelimit allocation failure warnings more aggressively
While investigating a bug related to higher atomic allocation failures, we noticed the failure warnings positively drowning the console, and in our case trigger lockup warnings because of a serial console too slow to handle all that output. But even if we had a faster console, it's unclear what additional information the current level of repetition provides. Allocation failures happen for three reasons: The machine is OOM, the VM is failing to handle reasonable requests, or somebody is making unreasonable requests (and didn't acknowledge their opportunism with __GFP_NOWARN). Having the memory dump, a callstack, and the ratelimit stats on skipped failure warnings should provide enough information to let users/admins/developers know whether something is wrong and point them in the right direction for debugging, bpftracing etc. Limit allocation failure warnings to one spew every ten seconds. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Johannes Weiner <[email protected]> Acked-by: David Rientjes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent ec649c9 commit 1be334e

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

mm/page_alloc.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3728,10 +3728,6 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
37283728
static void warn_alloc_show_mem(gfp_t gfp_mask, nodemask_t *nodemask)
37293729
{
37303730
unsigned int filter = SHOW_MEM_FILTER_NODES;
3731-
static DEFINE_RATELIMIT_STATE(show_mem_rs, HZ, 1);
3732-
3733-
if (!__ratelimit(&show_mem_rs))
3734-
return;
37353731

37363732
/*
37373733
* This documents exceptions given to allocations in certain
@@ -3752,8 +3748,7 @@ void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...)
37523748
{
37533749
struct va_format vaf;
37543750
va_list args;
3755-
static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL,
3756-
DEFAULT_RATELIMIT_BURST);
3751+
static DEFINE_RATELIMIT_STATE(nopage_rs, 10*HZ, 1);
37573752

37583753
if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs))
37593754
return;

0 commit comments

Comments
 (0)