--- a/include/linux/swapops.h~mm-correct-guards-for-non_swap_entry +++ a/include/linux/swapops.h @@ -350,7 +350,8 @@ static inline void num_poisoned_pages_in } #endif -#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION) +#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION) || \ + defined(CONFIG_DEVICE_PRIVATE) static inline int non_swap_entry(swp_entry_t entry) { return swp_type(entry) >= MAX_SWAPFILES;