Re: [PATCH hotfix] mm/migrate: fix kernel BUG at mm/compaction.c:2761!

From: Andrew Morton
Date: Wed Jun 12 2024 - 12:04:46 EST


On Wed, 12 Jun 2024 00:11:44 -0700 (PDT) Hugh Dickins <hughd@xxxxxxxxxx> wrote:

> > It appears better to add
> >
> > stats->nr_thp_failed++;
> >
> > too. Otherwise, if migrate_pages_batch() is called via migrate_pages(,
> > MIGRATE_ASYNC, ), nr_thp_failed will not increase. But if
> > migrate_pages_batch() is called via migrate_pages(, MIGRATE_SYNC*, ),
> > nr_thp_failed will increase in migrate_pages_sync() via
> >
> > stats->nr_thp_failed += astats.nr_thp_split;
> >
> > That is, they are not consistent. The issue exists since commit
> > 7262f208ca68 ("mm/migrate: split source folio if it is on deferred split
> > list").
>
> Sorry, I'll have to let you take over and send your own patch instead
> of mine - thanks. Those stats, and any attempt at consistency there,
> is way beyond me! I thought consistency was impossible, unless all
> the numbers were changed to order-0 counts.

I'll add this patch as-is for now.