*/
        BUILD_BUG_ON(pgd_index(direct_map_end - 1) == pgd_index(direct_map_end));
 
-       if (can_set_direct_map() || IS_ENABLED(CONFIG_KFENCE))
+       if (can_set_direct_map())
                flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS;
 
        /*
 
        VM_BUG_ON(!mhp_range_allowed(start, size, true));
 
-       /*
-        * KFENCE requires linear map to be mapped at page granularity, so that
-        * it is possible to protect/unprotect single pages in the KFENCE pool.
-        */
-       if (can_set_direct_map() || IS_ENABLED(CONFIG_KFENCE))
+       if (can_set_direct_map())
                flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS;
 
        __create_pgd_mapping(swapper_pg_dir, start, __phys_to_virt(start),
 
 
 bool can_set_direct_map(void)
 {
-       return rodata_full || debug_pagealloc_enabled();
+       /*
+        * rodata_full, DEBUG_PAGEALLOC and KFENCE require linear map to be
+        * mapped at page granularity, so that it is possible to
+        * protect/unprotect single pages.
+        */
+       return rodata_full || debug_pagealloc_enabled() ||
+               IS_ENABLED(CONFIG_KFENCE);
 }
 
 static int change_page_range(pte_t *ptep, unsigned long addr, void *data)