On Mon, Dec 16, 2024 at 10:20:58PM +0530, Dev Jain wrote: > { > - struct page *page = NULL; > - struct folio *folio = NULL; > - pte_t *_pte; > + unsigned int max_ptes_shared = khugepaged_max_ptes_shared >> (HPAGE_PMD_ORDER - order); > + unsigned int max_ptes_none = khugepaged_max_ptes_none >> (HPAGE_PMD_ORDER - order); > int none_or_zero = 0, shared = 0, result = SCAN_FAIL, referenced = 0; > + struct folio *folio = NULL; > + struct page *page = NULL; why are you moving variables around unnecessarily? > bool writable = false; > + pte_t *_pte; > > - for (_pte = pte; _pte < pte + HPAGE_PMD_NR; > + > + for (_pte = pte; _pte < pte + (1UL << order); spurious blank line also you might first want to finish off the page->folio conversion in this function first; we have a vm_normal_folio() now.