Matthew Wilcox <willy@xxxxxxxxxxxxx> writes: > On Tue, Nov 01, 2022 at 02:21:37PM +0800, Huang Ying wrote: >> - is_thp = PageTransHuge(page) && !PageHuge(page); >> - nr_subpages = compound_nr(page); >> + is_large = folio_test_large(folio) && !PageHuge(&folio->page); > > We have folio_test_hugetlb() to replace PageHuge(). Thanks! Will change this in the next version. >> count_vm_events(PGMIGRATE_SUCCESS, nr_succeeded); >> count_vm_events(PGMIGRATE_FAIL, nr_failed_pages); >> - count_vm_events(THP_MIGRATION_SUCCESS, nr_thp_succeeded); >> - count_vm_events(THP_MIGRATION_FAIL, nr_thp_failed); >> - count_vm_events(THP_MIGRATION_SPLIT, nr_thp_split); >> - trace_mm_migrate_pages(nr_succeeded, nr_failed_pages, nr_thp_succeeded, >> - nr_thp_failed, nr_thp_split, mode, reason); >> + count_vm_events(THP_MIGRATION_SUCCESS, nr_large_succeeded); >> + count_vm_events(THP_MIGRATION_FAIL, nr_large_failed); >> + count_vm_events(THP_MIGRATION_SPLIT, nr_split); >> + trace_mm_migrate_pages(nr_succeeded, nr_failed_pages, nr_large_succeeded, >> + nr_large_failed, nr_split, mode, reason); > > I think this is the biggest question with this patch -- how (or whether) > to account folios in size between PMD and PTE size. Since it's > _called_ THP, I've tended to make the statistics conditional on > folio_test_pmd_mappable() rather than simply being folio_test_large(). Yes. This is my biggest concern during development too. In the next version, I will distinguish THP and other large folios (between PMD and PTE size) and do statistics accordingly. Best Regards, Huang, Ying