From patchwork Fri Jan 10 20:33:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Hahn X-Patchwork-Id: 13935462 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0166BE77188 for ; Fri, 10 Jan 2025 20:33:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B9EE6B00C8; Fri, 10 Jan 2025 15:33:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 86A556B00C9; Fri, 10 Jan 2025 15:33:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70AA26B00CA; Fri, 10 Jan 2025 15:33:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4F11A6B00C8 for ; Fri, 10 Jan 2025 15:33:07 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0615BA0DB9 for ; Fri, 10 Jan 2025 20:33:07 +0000 (UTC) X-FDA: 82992691614.01.B530D7A Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf16.hostedemail.com (Postfix) with ESMTP id 41956180011 for ; Fri, 10 Jan 2025 20:33:05 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LFPQQN9T; spf=pass (imf16.hostedemail.com: domain of joshua.hahnjy@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=joshua.hahnjy@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736541185; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=R3OHJ55YjZuO0+2TEYbtIvFFyGO1wuck5p4Zg10LFD8=; b=MAp1N4+JJOCzW5POYPSRDTl2skrEoLcUgErPZ2aJSRe8jZh+FHAFWxZ2N4h6JcXLoWS2+3 9qxmm7+L6JcHpSngro8pqJ5hFUB5RVncu1Gp9BM/MhHog7xh/yfq0HjZmZerhCCbPglG7N miT5QTtBW5yd6qYZHgP0oy7K69Y2IOU= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LFPQQN9T; spf=pass (imf16.hostedemail.com: domain of joshua.hahnjy@gmail.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=joshua.hahnjy@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736541185; a=rsa-sha256; cv=none; b=8YCgv6upIDc2kKkjGqG/aWwj0QJjRLHyWgpceTjdGNnDMk0UAVc3oLBY19R6OrafZmVDlb Ir7V2fQrvZzmrIrrErPWSCG/UPXwCnVXluoFVj1n+8cWYmc6EsBdgou/sE2A7tKnsIevc8 VGTs/PwtiHxEhfrtcaYXsiFdVItdKR8= Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-e4930eca0d4so3541867276.3 for ; Fri, 10 Jan 2025 12:33:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736541184; x=1737145984; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=R3OHJ55YjZuO0+2TEYbtIvFFyGO1wuck5p4Zg10LFD8=; b=LFPQQN9TTD97YB/69y7zr46Nbz0//XQPiCUZ1HwcGSdFRXTLE5EzqtQIxCu5xxKRQF xQJ3BOkYhljZ1shZB/IvHVyL9uMIvn84NCeK1pjVoTXw45z3r6/CHdS0Fqd9Gf3KqaNA cE1SmsK9XjRTe6gQhU8m62Xgw8JkTPFU2RmYR/IlWEhU/a5zglWnJOHqUd86DnQp/JyR zWI+DTNq9s5mXDNvmulTi+6rJzo4lgcJsQVYk3ASX3UZxNGKIENRBDCzLbDRaPsn+ZGV R6P/6PzRAtIEXLlz+EYTY2/GOs1Xl71sJGEntsRONjF76QTo7gh/Qx2A9mc7R9k90+im EdJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736541184; x=1737145984; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=R3OHJ55YjZuO0+2TEYbtIvFFyGO1wuck5p4Zg10LFD8=; b=S8WNttylyrOnMOFB7xQs1THE8YTHLqPWLy0M9HTioRg6m3JgSM5lI1lF0nR85soFWa jx10538W2yrUT1eWKd0PQJjv/FqlYwVf54nGf8nomuNvOiEPsjvRFzWcfOjTJB7BWqoT 26RLfbR6DPr2oiiie6mdhJOnOxFKoO/Ed/4ybxtzpVfakORLwdk99WnWFCPOTfExTNMD DFt0SpPsDirFpdR/b1TlCFOtV3IbQGypJjM/4Oo0VIgDK/T0ZZNqNolbjmSLET5vc7SV KXHtLtwhvlW1Pa5Hr4Q1CiJN32j2s1KJ9tNxQ9JPO3ombjZ8n1s41Qcx8IGnJnGSpdU6 Xz+A== X-Forwarded-Encrypted: i=1; AJvYcCUGL0TojBlyr+j+IwrASCspK4d2z3cxo1n1qmDDPiYklPIhe+Vc/NPWCmiXb9IwhDQPm3g3N609UQ==@kvack.org X-Gm-Message-State: AOJu0YxLdl6b518tp5fLNfHfZcVE2qNEJ5GEHnLHqK2MQaOo/9uph9MH GoJdv8lVrpPlV54sJDYBHTZvo/q2E2u5Ix7jKWh+NiKMPHtmuNF1 X-Gm-Gg: ASbGncuDIzTqRvFPiGwSkABYUjUdjY9SpvmMUIOGa3c215cy8aIhrW5EhEpzWYjrFEl JuQQp/XamK27Fl1oBM24ulAToNMDkgE+SnFWlO+8Mvcoj95EVszc21rSXQj14oqDi3kvwW0OnC2 LSpPVP1VXMtibOyPNZIYwQzSoFp1xqlEBlXOdPmYsT7uXlVxQpx48nXb5nioLeIZfAC7iVtLTmW 59ijlDtt2wm92ukHxvBhaQ67mwrL77BY+2u3PCaxLX8DwBQ/jmAWDP1 X-Google-Smtp-Source: AGHT+IHCmp+eAzAGnQjwwdQGn5KAwPmGCrDSSiwluombVvZ/VJNdnpcLNkz5cpzbV5HcxeaM9CPBow== X-Received: by 2002:a05:6902:228c:b0:e4b:3d71:346a with SMTP id 3f1490d57ef6-e54edf4189bmr9823939276.11.1736541184242; Fri, 10 Jan 2025 12:33:04 -0800 (PST) Received: from localhost ([2a03:2880:25ff:71::]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e55a593f26csm471885276.6.2025.01.10.12.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 12:33:03 -0800 (PST) From: Joshua Hahn To: Johannes Weiner , Chengming Zhou Cc: Andrew Morton , Nhat Pham , Yosry Ahmed , linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-team@meta.com Subject: [PATCH] mm/zswap: Remove zswap_pools_counter Date: Fri, 10 Jan 2025 12:33:02 -0800 Message-ID: <20250110203303.3658816-1-joshua.hahnjy@gmail.com> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 X-Rspamd-Queue-Id: 41956180011 X-Stat-Signature: sktz5jdkujbq76pcdtbspqwphswp313c X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736541185-31876 X-HE-Meta: U2FsdGVkX18SBh+IGWDVJmzOLb9QwzbbxTEa9WTl9n85SAf83mREX/PUTprNgCC3A+qVzMUtqJJgQsYR/sNVsGOhK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etW8Pf8xzwn1EOiwdtgQGHafGNB0TxSRFAcDb0/zyedbuJe/ocF+zyUT8de3UE1Ql8QuKay9v44UdAw6MpesaYNnVPNZkHRMwUVkEeivc8qYe0UzwtNDtA6IbSXqHoRDSRTBko82xEBq+0lISwNS7mpjZBBw5x7i6yAwgc4XpQ8p9ljqVpqaP0guwub/TfUIP1V1QOcq7L5klKVkNbqephVjQen2e4EXCmgQ5584tdYSMrXpQCReBs3bRsM/WyoQIw1hfDUbqVqgbWxtNubUb/zikUHdtOTLwSfSD8mq+HQTHla5PKfDrRJQAK1aSTXL7XF74= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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" string formatting with "zswap". Signed-off-by: Joshua Hahn [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;