Re: [PATCH] mm: vmpressure: scale window size based on machine memory
From: Taha Sezer
Date: Tue Sep 01 2026 - 02:45:12 EST
Hi Lorenzo, Andrew,
Thanks for the honest and thorough review.
Lorenzo -- yes, I did use an AI coding assistant (Claude) to help
write this patch. I should have included an Assisted-by: tag from
the start and I apologise for the omission. That was a mistake on
my part, not an attempt to hide anything -- I simply was not aware of
the disclosure process for my first submission.
Andrew -- you are absolutely right about the math. The original window
is SWAP_CLUSTER_MAX * 16 = 512 pages, and my formula clamp(fls(mem),
4, 64) produces values well below 16 for every machine under ~8 TB.
The patch shrinks the window on virtually all real hardware, which is
the exact opposite of what the commit message promises. Embarrassing,
and I should have caught this before sending.
For a bit of context on why I chose mm/: I have been writing a hobby
kernel from scratch (Caelum) that includes a VMM with COW and demand
paging, a slab allocator with NUMA-aware allocation, TLB shootdown
via IPI, and SMP boot -- so memory management is the area I am most
comfortable with. That said, comfortable with the concepts clearly
did not save me from a basic arithmetic mistake here, and I take full
responsibility for not verifying the output carefully enough.
Before I send a v2, I would appreciate any guidance:
1. Is the general idea still worth pursuing -- scaling the window
logarithmically with total RAM using fls(), or do you think
the fixed 512-page window is fine as-is and this TODO is
better left alone?
2. If the approach is worth fixing: would keeping the original
multiplier of 16 as the floor (so the window only ever grows
beyond 512 pages) be the right direction, or would you prefer
a different scaling strategy entirely?
3. Any other advice for a first-time contributor on how to
approach mm/ patches more carefully?
I will hold off on v2 until I hear back, so I do not waste anyone's
time with another half-baked attempt. The next version will include
a proper Assisted-by: Claude:claude-opus-4 tag.
Thanks again for the patience.
Best regards,
Taha Sezer