return true;
        }
 
+       /*
+        * Seek to next pte only makes sense for THP.
+        * But more important than that optimization, is to filter out
+        * any PageKsm page: whose page->index misleads vma_address()
+        * and vma_address_end() to disaster.
+        */
+       end = PageTransCompound(page) ?
+               vma_address_end(page, pvmw->vma) :
+               pvmw->address + PAGE_SIZE;
        if (pvmw->pte)
                goto next_pte;
 restart:
                if (check_pte(pvmw))
                        return true;
 next_pte:
-               /* Seek to next pte only makes sense for THP */
-               if (!PageTransHuge(page))
-                       return not_found(pvmw);
-               end = vma_address_end(page, pvmw->vma);
                do {
                        pvmw->address += PAGE_SIZE;
                        if (pvmw->address >= end)