Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: zswap: remove unnecessary check in zswap_find_zpool()

zswap_find_zpool() checks if ZSWAP_NR_ZPOOLS > 1, which is always true.
This is a remnant from a patch version that had ZSWAP_NR_ZPOOLS as a
config option and never made it upstream. Remove the unnecessary check.

Link: https://lkml.kernel.org/r/20240311235210.2937484-1-yosryahmed@google.com
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>
Reviewed-by: Nhat Pham <nphamcs@gmail.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Yosry Ahmed and committed by
Andrew Morton
fea68a75 c2af060d

+1 -6
+1 -6
mm/zswap.c
··· 871 871 872 872 static struct zpool *zswap_find_zpool(struct zswap_entry *entry) 873 873 { 874 - int i = 0; 875 - 876 - if (ZSWAP_NR_ZPOOLS > 1) 877 - i = hash_ptr(entry, ilog2(ZSWAP_NR_ZPOOLS)); 878 - 879 - return entry->pool->zpools[i]; 874 + return entry->pool->zpools[hash_ptr(entry, ilog2(ZSWAP_NR_ZPOOLS))]; 880 875 } 881 876 882 877 /*