Commit a259945
mm/migrate: correct nr_failed in migrate_pages_sync()
nr_failed was missing the large folio splits from migrate_pages_batch()
and can cause a mismatch between migrate_pages() return value and the
number of not migrated pages, i.e., when the return value of
migrate_pages() is 0, there are still pages left in the from page list.
It will happen when a non-PMD THP large folio fails to migrate due to
-ENOMEM and is split successfully but not all the split pages are not
migrated, migrate_pages_batch() would return non-zero, but
astats.nr_thp_split = 0. nr_failed would be 0 and returned to the caller
of migrate_pages(), but the not migrated pages are left in the from page
list without being added back to LRU lists.
Fix it by adding a new nr_split counter for large folio splits and adding
it to nr_failed in migrate_page_sync() after migrate_pages_batch() is
done.
Link: https://lkml.kernel.org/r/20231017163129.2025214-1-zi.yan@sent.com
Fixes: 2ef7dbb ("migrate_pages: try migrate in batch asynchronously firstly")
Signed-off-by: Zi Yan <ziy@nvidia.com>
Acked-by: Huang Ying <ying.huang@intel.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent 245245c commit a259945
1 file changed
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1495 | 1495 | | |
1496 | 1496 | | |
1497 | 1497 | | |
| 1498 | + | |
1498 | 1499 | | |
1499 | 1500 | | |
1500 | 1501 | | |
| |||
1614 | 1615 | | |
1615 | 1616 | | |
1616 | 1617 | | |
| 1618 | + | |
1617 | 1619 | | |
1618 | 1620 | | |
1619 | 1621 | | |
| |||
1629 | 1631 | | |
1630 | 1632 | | |
1631 | 1633 | | |
1632 | | - | |
| 1634 | + | |
| 1635 | + | |
1633 | 1636 | | |
1634 | 1637 | | |
1635 | 1638 | | |
| |||
1649 | 1652 | | |
1650 | 1653 | | |
1651 | 1654 | | |
| 1655 | + | |
1652 | 1656 | | |
1653 | 1657 | | |
1654 | 1658 | | |
| |||
1677 | 1681 | | |
1678 | 1682 | | |
1679 | 1683 | | |
1680 | | - | |
| 1684 | + | |
1681 | 1685 | | |
1682 | 1686 | | |
1683 | 1687 | | |
1684 | 1688 | | |
| 1689 | + | |
1685 | 1690 | | |
1686 | 1691 | | |
1687 | 1692 | | |
| |||
1827 | 1832 | | |
1828 | 1833 | | |
1829 | 1834 | | |
| 1835 | + | |
1830 | 1836 | | |
1831 | 1837 | | |
1832 | 1838 | | |
1833 | 1839 | | |
1834 | 1840 | | |
1835 | 1841 | | |
1836 | 1842 | | |
1837 | | - | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
1838 | 1848 | | |
1839 | 1849 | | |
1840 | 1850 | | |
| |||
0 commit comments