Re: [RFC 0/6] migrate_pages(): batch TLB flushing

From: Bharata B Rao
Date: Tue Sep 27 2022 - 06:47:11 EST


On 9/23/2022 1:22 PM, Huang, Ying wrote:
> Bharata B Rao <bharata@xxxxxxx> writes:
>>
>> Thanks for the patchset. I find it hitting the following BUG() when
>> running mmtests/autonumabench:
>>
>> kernel BUG at mm/migrate.c:2432!
>>
>> This is BUG_ON(!list_empty(&migratepages)) in migrate_misplaced_page().
>
> Thank you very much for reporting! I haven't reproduced this yet. But
> I will pay special attention to this when develop the next version, even
> if I cannot reproduce this finally.

The following change fixes the above reported BUG_ON().

diff --git a/mm/migrate.c b/mm/migrate.c
index a0de0d9b4d41..c11dd82245e5 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1197,7 +1197,7 @@ static int migrate_page_unmap(new_page_t get_new_page, free_page_t put_new_page,
* references and be restored.
*/
/* restore the page to right list. */
- if (rc != -EAGAIN)
+ if (rc == -EAGAIN)
ret = NULL;

migrate_page_undo_page(page, page_was_mapped, anon_vma, locked, ret);

The pages that returned from unmapping stage with -EAGAIN used to
end up on "ret" list rather than continuing on the "from" list.

Regards,
Bharata.