From: Liu Shixin <liushixin2@huawei.com>
To: Seth Jennings <sjenning@redhat.com>,
Dan Streetman <ddstreet@ieee.org>,
Vitaly Wool <vitaly.wool@konsulko.com>,
Andrew Morton <akpm@linux-foundation.org>,
Nathan Chancellor <nathan@kernel.org>,
Christoph Hellwig <hch@lst.de>
Cc: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
Liu Shixin <liushixin2@huawei.com>
Subject: [PATCH -next v9 1/3] mm/zswap: remove zswap_entry_cache_{create,destroy} helper function
Date: Tue, 11 Apr 2023 17:36:30 +0800 [thread overview]
Message-ID: <20230411093632.822290-2-liushixin2@huawei.com> (raw)
In-Reply-To: <20230411093632.822290-1-liushixin2@huawei.com>
Remove zswap_entry_cache_create and zswap_entry_cache_destroy and use
kmem_cache_* function directly.
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
mm/zswap.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/mm/zswap.c b/mm/zswap.c
index 2f0ebd8bc620..6d2b879f091e 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -272,17 +272,6 @@ static void zswap_update_total_size(void)
**********************************/
static struct kmem_cache *zswap_entry_cache;
-static int __init zswap_entry_cache_create(void)
-{
- zswap_entry_cache = KMEM_CACHE(zswap_entry, 0);
- return zswap_entry_cache == NULL;
-}
-
-static void __init zswap_entry_cache_destroy(void)
-{
- kmem_cache_destroy(zswap_entry_cache);
-}
-
static struct zswap_entry *zswap_entry_cache_alloc(gfp_t gfp)
{
struct zswap_entry *entry;
@@ -1489,7 +1478,8 @@ static int __init init_zswap(void)
zswap_init_started = true;
- if (zswap_entry_cache_create()) {
+ zswap_entry_cache = KMEM_CACHE(zswap_entry, 0);
+ if (!zswap_entry_cache) {
pr_err("entry cache creation failed\n");
goto cache_fail;
}
@@ -1538,7 +1528,7 @@ static int __init init_zswap(void)
hp_fail:
cpuhp_remove_state(CPUHP_MM_ZSWP_MEM_PREPARE);
dstmem_fail:
- zswap_entry_cache_destroy();
+ kmem_cache_destroy(zswap_entry_cache);
cache_fail:
/* if built-in, we aren't unloaded on failure; don't allow use */
zswap_init_failed = true;
--
2.25.1
next prev parent reply other threads:[~2023-04-11 8:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-11 9:36 [PATCH -next v9 0/3] Delay the initialization of zswap Liu Shixin
2023-04-11 9:36 ` Liu Shixin [this message]
2023-04-11 9:36 ` [PATCH -next v9 2/3] mm/zswap: replace zswap_init_{started/failed} with zswap_init_state Liu Shixin
2023-04-11 9:36 ` [PATCH -next v9 3/3] mm/zswap: delay the initialization of zswap Liu Shixin
2023-04-12 15:20 ` Christoph Hellwig
2023-05-04 0:11 ` [PATCH -next v9 0/3] Delay " Chris Li
2023-05-04 7:11 ` Liu Shixin
2023-05-04 14:53 ` Chris Li
2023-05-08 1:37 ` Liu Shixin
2023-05-20 15:33 ` Chris Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230411093632.822290-2-liushixin2@huawei.com \
--to=liushixin2@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=ddstreet@ieee.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nathan@kernel.org \
--cc=sjenning@redhat.com \
--cc=vitaly.wool@konsulko.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox