Hi, > for (pgidx = 0; pgidx < pgcnt; pgidx++) { > + if (is_file_hugepages(memfd)) { > + hpage = find_get_page_flags( > + file_inode(memfd)->i_mapping, > + pgoff, FGP_ACCESSED); > + if (IS_ERR(hpage)) { > + ret = PTR_ERR(hpage); > + goto err; > + } > + > + page = hpage + (subpgoff % maxsubpgs); > + get_page(page); > + put_page(hpage); if (hpage && subpgoff == maxsubpgs) { put_page(hpage); hpage = NULL; } if (!hpage) { hpage = find_get_page_flags(...) [ ... ] } Only lookup the huge page when you cross a hugepage border. take care, Gerd