Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a05c9ec1 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mm: throttle show_mem() from warn_alloc()"

parents 1e7a568a e3af59c5
Loading
Loading
Loading
Loading
+18 −13
Original line number Diff line number Diff line
@@ -3098,18 +3098,12 @@ static inline bool should_suppress_show_mem(void)
	return ret;
}

static DEFINE_RATELIMIT_STATE(nopage_rs,
		DEFAULT_RATELIMIT_INTERVAL,
		DEFAULT_RATELIMIT_BURST);

void warn_alloc(gfp_t gfp_mask, const char *fmt, ...)
static void warn_alloc_show_mem(gfp_t gfp_mask)
{
	unsigned int filter = SHOW_MEM_FILTER_NODES;
	struct va_format vaf;
	va_list args;
	static DEFINE_RATELIMIT_STATE(show_mem_rs, HZ, 1);

	if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs) ||
	    debug_guardpage_minorder() > 0)
	if (should_suppress_show_mem() || !__ratelimit(&show_mem_rs))
		return;

	/*
@@ -3124,6 +3118,20 @@ void warn_alloc(gfp_t gfp_mask, const char *fmt, ...)
	if (in_interrupt() || !(gfp_mask & __GFP_DIRECT_RECLAIM))
		filter &= ~SHOW_MEM_FILTER_NODES;

	show_mem(filter);
}

void warn_alloc(gfp_t gfp_mask, const char *fmt, ...)
{
	struct va_format vaf;
	va_list args;
	static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL,
				      DEFAULT_RATELIMIT_BURST);

	if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs) ||
	    debug_guardpage_minorder() > 0)
		return;

	pr_warn("%s: ", current->comm);

	va_start(args, fmt);
@@ -3135,10 +3143,7 @@ void warn_alloc(gfp_t gfp_mask, const char *fmt, ...)
	pr_cont(", mode:%#x(%pGg)\n", gfp_mask, &gfp_mask);

	dump_stack();
	if (!should_suppress_show_mem()) {
		show_mem(filter);
		show_mem_call_notifiers();
	}
	warn_alloc_show_mem(gfp_mask);
}

static inline struct page *