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

From: Huang, Ying
Date: Mon Jan 16 2023 - 01:12:40 EST


Matthew Wilcox <willy@xxxxxxxxxxxxx> writes:

> 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()?

Yes. Thank you very much for pointing this out. Will fix it for the
next version.

Best Regards,
Huang, Ying