[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250110203303.3658816-1-joshua.hahnjy@gmail.com>
Date: Fri, 10 Jan 2025 12:33:02 -0800
From: Joshua Hahn <joshua.hahnjy@...il.com>
To: Johannes Weiner <hannes@...xchg.org>,
Chengming Zhou <chengming.zhou@...ux.dev>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Nhat Pham <nphamcs@...il.com>,
Yosry Ahmed <yosryahmed@...gle.com>,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
kernel-team@...a.com
Subject: [PATCH] mm/zswap: Remove zswap_pools_counter
Commit 8edc9c4 [1] reduced the number of pools used by zswap from 32 to 1.
As such, we no longer need to have unique names for zpool (zsmalloc).
Remove the atomic counter that keeps track of the number of allocated pools,
and replace the "zswap<n>" string formatting with "zswap".
Signed-off-by: Joshua Hahn <joshua.hahnjy@...il.com>
[1] https://lore.kernel.org/all/20240617-zsmalloc-lock-mm-everything-v1-2-5e5081ea11b3@linux.dev/T/#u
---
mm/zswap.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/mm/zswap.c b/mm/zswap.c
index 5a27af8d86ea..bc43e807de29 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -210,8 +210,6 @@ static unsigned int nr_zswap_trees[MAX_SWAPFILES];
static LIST_HEAD(zswap_pools);
/* protects zswap_pools list modification */
static DEFINE_SPINLOCK(zswap_pools_lock);
-/* pool counter to provide unique names to zpool */
-static atomic_t zswap_pools_count = ATOMIC_INIT(0);
enum zswap_init_type {
ZSWAP_UNINIT,
@@ -249,7 +247,6 @@ static void __zswap_pool_empty(struct percpu_ref *ref);
static struct zswap_pool *zswap_pool_create(char *type, char *compressor)
{
struct zswap_pool *pool;
- char name[38]; /* 'zswap' + 32 char (max) num + \0 */
gfp_t gfp = __GFP_NORETRY | __GFP_NOWARN | __GFP_KSWAPD_RECLAIM;
int ret;
@@ -268,9 +265,7 @@ static struct zswap_pool *zswap_pool_create(char *type, char *compressor)
if (!pool)
return NULL;
- /* unique name for each pool specifically required by zsmalloc */
- snprintf(name, 38, "zswap%x", atomic_inc_return(&zswap_pools_count));
- pool->zpool = zpool_create_pool(type, name, gfp);
+ pool->zpool = zpool_create_pool(type, "zswap", gfp);
if (!pool->zpool) {
pr_err("%s zpool not available\n", type);
goto error;
--
2.43.5
Powered by blists - more mailing lists