Re: [PATCH V2] mm: madvise: fix uneven accounting of psi

From: Johannes Weiner
Date: Tue Jun 27 2023 - 10:49:17 EST


Hi Charan,

thanks for fixing this. One comment:

On Tue, Jun 27, 2023 at 04:03:12PM +0530, Charan Teja Kalla wrote:
> @@ -413,6 +413,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd,
>
> folio_clear_referenced(folio);
> folio_test_clear_young(folio);
> + folio_set_workingset(folio);

Unless I'm missing something, this also includes inactive pages, which
is undesirable. Shouldn't this be:

if (folio_test_active(folio))
folio_set_workingset(folio);

> @@ -512,6 +513,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd,
> */
> folio_clear_referenced(folio);
> folio_test_clear_young(folio);
> + folio_set_workingset(folio);

Here as well.