Re: [PATCH] mm, swap: ratelimit bad swap entry reports
From: David Hildenbrand (Arm)
Date: Wed Aug 19 2026 - 04:05:49 EST
On 8/18/26 21:28, Andrew Morton wrote:
> On Tue, 18 Aug 2026 02:03:40 -0700 Breno Leitao <leitao@xxxxxxxxxx> wrote:
>
>> A corrupt page table hands the same bogus entry to get_swap_device() on
>> every access to the mapping, and every rejection is logged. One machine
>> logged 6185620 copies of the same line in a few hours.
>>
>> swap_dup_entry_direct() prints the same message from the fork path, once
>> per call: the WARN_ON_ONCE() guarding it warns once, the pr_err() inside
>> does not.
>>
>> Rate limit all three prints.
>
> Sashiko suggests that ratelimiting these might cause pre-existing
> problems to become worse:
> https://sashiko.dev/#/patchset/20260818-swap_part_one-v1-1-a4fc58119fc0@xxxxxxxxxx
>
The fist problem it raises is actually fixed by the other patchset this was
split off from.
I didn't look into the other case.
> The problem it's identifying does require that unrelated things go
> wrong first -
As described above: "A corrupt page table hands the same bogus entry to
get_swap_device()", that requires something in the caller to go wrong (page
table corruption, similar to how we handle it in other places for present ptes)
--
Cheers,
David