Re: [PATCH -v2 0/9] migrate_pages(): batch TLB flushing

From: Matthew Wilcox
Date: Sun Jan 15 2023 - 23:36:29 EST


On Fri, Jan 13, 2023 at 10:42:08AM +0800, Huang, Ying wrote:
> +++ b/mm/migrate.c
> @@ -1187,10 +1187,13 @@ static int __migrate_folio_move(struct folio *src, struct folio *dst,
> int rc;
> int page_was_mapped = 0;
> struct anon_vma *anon_vma = NULL;
> + bool is_lru = !__PageMovable(&src->page);
>
> __migrate_folio_extract(dst, &page_was_mapped, &anon_vma);
>
> rc = move_to_new_folio(dst, src, mode);
> + if (!unlikely(is_lru))
> + goto out_unlock_both;

This reads a little awkwardly. Could it be:

if (likely(!is_lru))

... but honestly, I think the polarity here is wrong. LRU pages tend to
outnumber !LRU pages, so shouldn't this be:

if (unlikely(!is_lru)) {

just like it is in migrate_folio_unmap()?