Re: [PATCH v3 01/18] mm/swap: fix off-by-one in swap cache replace sanity check
Barry Song <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.linux.kernel.mm |
|---|---|
| Message-ID | <CAGsJ_4y5AA_KrV2t1bFAeTEpDE6JJ+jG3bt0-+W2LNJdyub2cA@mail.gmail.com> |
On Fri, Aug 21, 2026 at 2:55 AM Kairui Song via B4 Relay <[email protected]> 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") > Acked-by: Zi Yan <[email protected]> > Signed-off-by: Kairui Song <[email protected]> LGTM, thanks! Reviewed-by: Barry Song <[email protected]>