Re: [PATCH -next v2 18/19] mm: use folio_xchg_last_cpupid() in wp_page_reuse()

From: Matthew Wilcox
Date: Fri Oct 13 2023 - 11:19:18 EST


On Fri, Oct 13, 2023 at 04:56:02PM +0800, Kefeng Wang wrote:
> Convert to use folio_xchg_last_cpupid() in wp_page_reuse(), and remove
> page variable.

... another case where we're changing behaviour and need to argue it's
desirable.

> - /*
> - * Clear the pages cpupid information as the existing
> - * information potentially belongs to a now completely
> - * unrelated process.
> - */
> - if (page)
> - page_cpupid_xchg_last(page, (1 << LAST_CPUPID_SHIFT) - 1);
> + if (folio) {
> + VM_BUG_ON(folio_test_anon(folio) &&
> + !PageAnonExclusive(vmf->page));
> + /*
> + * Clear the pages cpupid information as the existing

s/pages/folio's/

> + * information potentially belongs to a now completely
> + * unrelated process.
> + */
> + folio_xchg_last_cpupid(folio, (1 << LAST_CPUPID_SHIFT) - 1);
> + }