Balbir Singh [off-list ref] writes:
+ address = start;
+ do {
+ local_irq_disable();
+ find_linux_pte(mm->pgd, address, &is_thp, &hshift);
+ if (!is_thp)
+ shift = PAGE_SHIFT;
It can still be hugetlb if is_thp is false.
+ else if (hshift && !is_thp)
+ shift = hshift;
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+ else
+ shift = HPAGE_PMD_SIZE;
That is wrong. I guess it should be shift = HPAGE_PMD_SHIFT. But i am
not sure we need to make it this complex at all. See below.
+#else
+ else {
+ shift = PAGE_SHIFT;
+ pr_warn_once("unsupport page size for mm %p,addr %lx\n",
+ mm, start);
+ }
+#endif
I am still not sure this is correct from a pure page table walking
point. Why not
if (hshift)
shift = hshift;
else
shift = PAGE_SHIFT;
if you didn't want to differentiate between thp and hugetlb mapping you
can drop is_thp completely.
-aneesh