Re: [PATCH] mm: madvise: drop MADV_PAGEOUT folios at swap writeback completion
From: Gregory Price
Date: Tue Sep 22 2026 - 11:39:48 EST
On Tue, Sep 22, 2026 at 11:44:20AM +0100, Lorenzo Stoakes (ARM) wrote:
> > @@ -554,10 +567,12 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd,
> > folio_set_workingset(folio);
> > if (pageout) {
> > if (folio_isolate_lru(folio)) {
> > - if (folio_test_unevictable(folio))
> > + if (folio_test_unevictable(folio)) {
> > folio_putback_lru(folio);
> > - else
> > + } else {
> > + madvise_mark_dropbehind(folio);
> > list_add(&folio->lru, &folio_list);
> > + }
> > }
>
> This existing code is utterly horrible can we maybe do some refactoring before
> adding yet more functionality here?
>
> I feel like the 'pay down technical debt first' take I had in THP is pretty
> valid here also.
>
> But also, yeah you DEFINITELY need to separate out patches here.
>
I will post my refactor today, sorry for the delay.