From: Baoquan He xswap pages live only in zswap. Without zswap, swapout cannot free the page, but still takes a swap entry. So the device consumes swap entries without freeing memory. Fail to create a device when zswap is unavailable. Acked-by: Chris Li Signed-off-by: Baoquan He --- mm/swapfile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/swapfile.c b/mm/swapfile.c index 1f319e365b68..ba899e349e99 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -4089,6 +4089,10 @@ static int xswap_create(int prio) unsigned int type; int error; + /* xswap has no backing store, it relies on zswap. */ + if (!zswap_is_enabled()) + return -EOPNOTSUPP; + mutex_lock(&xswap_ctl_lock); spin_lock(&swap_lock); -- 2.54.0