* + mm-page_alloc-replace-custom-bad-page-ratelimiting-logic.patch added to mm-new branch
@ 2026-08-30 3:33 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-08-30 3:33 UTC (permalink / raw)
To: mm-commits, ziy, vbabka, surenb, sj, rppt, mhocko, ljs, liam,
hannes, david, brendan.jackman, pfalcato, akpm
The patch titled
Subject: mm/page_alloc: replace custom bad page ratelimiting logic
has been added to the -mm mm-new branch. Its filename is
mm-page_alloc-replace-custom-bad-page-ratelimiting-logic.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-page_alloc-replace-custom-bad-page-ratelimiting-logic.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Pedro Falcato <pfalcato@suse.de>
Subject: mm/page_alloc: replace custom bad page ratelimiting logic
Date: Tue, 11 Aug 2026 18:21:56 +0100
The current logic (allow up to $BURST prints per minute) can be entirely
replaced by the generic version in lib/ratelimit.c, used around the
kernel.
Do so. The only functional difference should be that the new logs will
read something like:
KERN_WARNING "bad_page: %d callbacks suppressed\n", ...
But that should be fine enough.
Link: https://lore.kernel.org/20260811172156.356053-3-pfalcato@suse.de
Signed-off-by: Pedro Falcato <pfalcato@suse.de>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: SJ Park <sj@kernel.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Brendan Jackman <brendan.jackman@linux.dev>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/page_alloc.c | 28 +++++-----------------------
1 file changed, 5 insertions(+), 23 deletions(-)
--- a/mm/page_alloc.c~mm-page_alloc-replace-custom-bad-page-ratelimiting-logic
+++ a/mm/page_alloc.c
@@ -613,31 +613,13 @@ static inline bool __maybe_unused bad_ra
}
#endif
+/* Allow a burst of 60 reports per minute */
+static DEFINE_RATELIMIT_STATE(bad_page_ratelimit, 60 * HZ, 60);
+
static void bad_page(struct page *page, const char *reason)
{
- static unsigned long resume;
- static unsigned long nr_shown;
- static unsigned long nr_unshown;
-
- /*
- * Allow a burst of 60 reports, then keep quiet for that minute;
- * or allow a steady drip of one report per second.
- */
- if (nr_shown == 60) {
- if (time_before(jiffies, resume)) {
- nr_unshown++;
- goto out;
- }
- if (nr_unshown) {
- pr_alert(
- "BUG: Bad page state: %lu messages suppressed\n",
- nr_unshown);
- nr_unshown = 0;
- }
- nr_shown = 0;
- }
- if (nr_shown++ == 0)
- resume = jiffies + 60 * HZ;
+ if (!__ratelimit(&bad_page_ratelimit))
+ goto out;
pr_alert("BUG: Bad page state in process %s pfn:%05lx\n",
current->comm, page_to_pfn(page));
_
Patches currently in -mm which might be from pfalcato@suse.de are
x86-alternative-exclude-text-poking-against-change_page_attr.patch
mm-replace-custom-bad-page-map-ratelimiting-logic.patch
mm-page_alloc-replace-custom-bad-page-ratelimiting-logic.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-30 3:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-30 3:33 + mm-page_alloc-replace-custom-bad-page-ratelimiting-logic.patch added to mm-new branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.