* references the entire folio counts exactly once, even when such special
  * page table entries are comprised of multiple ordinary page table entries.
  *
+ * Will report 0 for pages which cannot be mapped into userspace, such as
+ * slab, page tables and similar.
+ *
  * Return: The number of times this folio is mapped.
  */
 static inline int folio_mapcount(const struct folio *folio)
 {
-       if (likely(!folio_test_large(folio)))
-               return atomic_read(&folio->_mapcount) + 1;
+       int mapcount;
+
+       if (likely(!folio_test_large(folio))) {
+               mapcount = atomic_read(&folio->_mapcount) + 1;
+               /* Handle page_has_type() pages */
+               if (mapcount < PAGE_MAPCOUNT_RESERVE + 1)
+                       mapcount = 0;
+               return mapcount;
+       }
        return folio_large_mapcount(folio);
 }