<alexlzhu@xxxxxx> writes: [snip] > +static void thp_util_scan(unsigned long pfn_end) > +{ > + struct page *page = NULL; > + int bucket, current_pfn, num_utilized_pages; > + int i; > + /* > + * Scan through each memory zone in chunks of THP_UTIL_SCAN_SIZE > + * PFNs every second looking for anonymous THPs. > + */ > + for (i = 0; i < THP_UTIL_SCAN_SIZE; i++) { > + current_pfn = thp_scan.pfn; > + thp_scan.pfn += HPAGE_PMD_NR; > + if (current_pfn >= pfn_end) > + return; > + > + page = pfn_to_online_page(current_pfn); > + if (!page) > + continue; If my understanding were correct, the page may be offlined during pfn_to_online_page() and the following code. So we need to call get/put_online_mems(). If my understanding were incorrect, can anyone teach me on this? > + > + num_utilized_pages = thp_number_utilized_pages(page_folio(page)); > + bucket = thp_utilization_bucket(num_utilized_pages); > + if (bucket < 0) > + continue; > + > + thp_scan.buckets[bucket].nr_thps++; > + thp_scan.buckets[bucket].nr_zero_pages += (HPAGE_PMD_NR - num_utilized_pages); > + } > +} > + Best Regards, Huang, Ying