Re: [PATCH v3 2/4] mm: drop stale folio_ref_count()==1 check in do_swap_page reuse logic
From: Andrew Morton
Date: Tue Jul 07 2026 - 16:18:24 EST
On Tue, 7 Jul 2026 19:08:13 +0800 Barry Song <baohua@xxxxxxxxxx> wrote:
> > Sashiko points out two minor things (one flagged as medium, lol, sure sure).
> >
> > Here, you can clarify that folio_ref_count()==1 is true for freshly allocated
> > pages (due to the KSM check) in which case exclusive=true already.
>
> Hi Andrew,
>
> I saw that you've queued this in mm-new. Thanks very much for that!
>
> Would you mind adding the following sentences to the end of the changelog?
>
> The ksm_might_need_to_copy() check may allocate a fresh folio with
> folio_ref_count() == 1. Along that path, exclusive has already been
> set to true, so the folio can still be reused correctly.
Done, thanks.