On 27 Mar 2024, at 10:10, Kefeng Wang wrote: > With isolate_movable_folio() and folio_isolate_lru(), let's use > more folio in do_migrate_range() to save compound_head() calls. > > Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> > --- > mm/memory_hotplug.c | 30 +++++++++++++++--------------- > 1 file changed, 15 insertions(+), 15 deletions(-) > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index a444e2d7dd2b..bd207772c619 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -1774,14 +1774,14 @@ static int scan_movable_pages(unsigned long start, unsigned long end, > > static void do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) > { > + struct folio *folio; > unsigned long pfn; > - struct page *page, *head; > LIST_HEAD(source); > static DEFINE_RATELIMIT_STATE(migrate_rs, DEFAULT_RATELIMIT_INTERVAL, > DEFAULT_RATELIMIT_BURST); > > for (pfn = start_pfn; pfn < end_pfn; pfn++) { > - struct folio *folio; > + struct page *page, *head; You could get rid of head too. It is only used to calculate next pfn, so pfn = folio_to_pfn(folio) + folio_nr_pages(folio) - 1 would work. And the PageHuge(page) and PageTransHuge(page) can be simplified, since their pfn calculations are the same. Something like: if (folio_test_large(folio)) { pfn = folio_to_pfn(folio) + folio_nr_pages(folio) - 1; if (folio_test_hugetlb(folio)) { isolate_hugetlb(folio, &source); continue; } } -- Best Regards, Yan, Zi
Attachment:
signature.asc
Description: OpenPGP digital signature