Re: [PATCH RFC 01/13] mm/swap: fix off-by-one in swap cache replace sanity check
"Zi Yan" <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.linux.kernel.mm |
|---|---|
| Message-ID | <[email protected]> |
On Fri Aug 7, 2026 at 5:17 PM EDT, Kairui Song via B4 Relay wrote: > From: Kairui Song <[email protected]> > > The DEBUG_VM sanity check in __swap_cache_replace_folio() iterates > the old folio's range with "while (ci_off++ < ci_end)", so the loop > body runs on the already-incremented offset: the first entry is > skipped and one entry past the range is read. For a folio split > that entry belongs to the first after-split folio and was just > repointed by the replacement loop above, so the check would warn > spuriously whenever sub-folio orders differ from the head folio's, > as non-uniform swapcache splits now do. > > Use the same do-while pattern as the replacement loop. > > Fixes: 8578e0c00dcf ("mm, swap: use the swap table for the swap cache and switch API") > Signed-off-by: Kairui Song <[email protected]> > --- > mm/swap_state.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) LGTM. Acked-by: Zi Yan <[email protected]> -- Best Regards, Yan, Zi