From patchwork Sat Mar 25 07:14:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 13187622 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 9195CC6FD1C for ; Sat, 25 Mar 2023 06:24:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0774C6B0075; Sat, 25 Mar 2023 02:24:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F3FC56B007E; Sat, 25 Mar 2023 02:24:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E2CFB6B0087; Sat, 25 Mar 2023 02:24:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id CFAEE6B0075 for ; Sat, 25 Mar 2023 02:24:30 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 9E00D1A00E0 for ; Sat, 25 Mar 2023 06:24:30 +0000 (UTC) X-FDA: 80606431500.16.30EDBF1 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf15.hostedemail.com (Postfix) with ESMTP id E81D5A0007 for ; Sat, 25 Mar 2023 06:24:27 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=liushixin2@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679725468; a=rsa-sha256; cv=none; b=MaF5N5tyC9kBVrf/SCaiIxddkI0PjPiNn3fYXJjt08QpCgisc6vwD0uU3ZC/3jNDKvtiWb lakC1DiBrvj3ikAHJGG0k9JkZFOhcbxtCqUgxEQp5P9xQewXW5L4p8CpC8lD2kUmMWcTT8 y1vUQ2OVLsXUkNOhjDadc79bN+mUYjk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=liushixin2@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679725468; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=URgX+Q5L1x4pDLOmz0xPXrHJ48HPro6M5y2A0Xr3JOQ=; b=A0ltD82MeNRppitY5ld5IyEC4fynf6ieG/BH0EU5dnt/NQL7bpXacdqyFGo8OpCvAGInD6 x6f+VmsSbOJC/BYzyRqGRDx/s67/X+WtIUfe+PBtuJDAUuwZ2n8u3mEpGmTU+JzE7FRIbH 2SRh5YfepJXqYfwRm9zpck6CSG3i/TY= Received: from dggpemm100009.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Pk88j12lTzSncZ; Sat, 25 Mar 2023 14:20:53 +0800 (CST) Received: from huawei.com (10.175.113.32) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Sat, 25 Mar 2023 14:24:22 +0800 From: Liu Shixin To: Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton , Nathan Chancellor , Christoph Hellwig CC: , , Liu Shixin Subject: [PATCH -next v7 1/4] mm/zswap: remove zswap_entry_cache_{create,destroy} helper function Date: Sat, 25 Mar 2023 15:14:17 +0800 Message-ID: <20230325071420.2246461-2-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230325071420.2246461-1-liushixin2@huawei.com> References: <20230325071420.2246461-1-liushixin2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Queue-Id: E81D5A0007 X-Rspamd-Server: rspam01 X-Stat-Signature: 3qgmyyj5dezwwiekrru4meo544ae9sdt X-HE-Tag: 1679725467-988162 X-HE-Meta: U2FsdGVkX19yWDADXyHBZSMo+LBHI6slGV24U6GMGqCe44LARyk7WfqXXii365jCARFTjMSBPqYtY+Q9F+5oJDbjXXeG/W2Uk7sI0ucxXr2djQCahFA05e7IWiZnIqwwOsuIht9F/2GanJvG/ypTsi1GpWiLOVcRAHYaHc8Q910JqzwmHUn18trN9pYKgM66p1aVDp+GPagNseq0l2PqiwGMRQDcRB24MT+ZI9DuYI8y8NszVzxfeLcuUAXk/63syv1EDxYzprTfK8H4BxVUQuUa1JqHYumfunXuX3NHqU4Euk1Yb3KwruUvXPyvDJTDF+MNQsjDxxDlB6VBFzjJyed9qefDsLb9f1seOboKu17KES2eRPnskfgDvLuSN3eVkxd0xkA4U41+Z2L0VE2gBqqh/ZD6qeD/6yx4/0RiQsG7dCojPrAu4I9pUhXqNNo8b8THWPor1f7KtbZSGewH/YoKWrsl3E723/igXVi7OxPnJgTdHK5QoKN9dLVdy27EJ71woPocaYjBD5rI72KMxyUCBaI9TFZ0D65z757ycTRrGGb1bRqyAhE+foQoqTXW/N39AuEZPTwKeLQQdlX4IBjTEf1yrtJxh6CrB9+eD9s2F07WtiRlQNXB4jDcxm1SBBbgQtB5hoB8d86ivjn0w6fSrJ+wtEX4L/MNN58cdUpLPlGsJYGpFz/mEZ08MMQirVwGbfdn3UGshPrp1Y8syPfYheaFhgrdfiSRdPYhAOFn730Pexz62kc8TzGrwgNaREhyhGWpX/7/Ep5SvPATxplaV6HA823fP21tl5OIYPWkBzPWYZdmyW3YD0MdQdnr8rzKhfw8OGZ4bviTVSSTdLSp5u71Llny9EC5b9n/a34eBVxPk+PPxFRNLItNzFyveX1KglD4BGKobTZUJT+oh+DY4Qc6vIWxNLMlg7x2mH33sLgziAG0Q56lJMH96CHrfHbyTZ/kc4UZtjNNMPb ym4hna3F ZeRmyJ7LfspK2HSI+WsivjHo+Byr2arIOeKiTRxjwL0QcIvm3cVKBsbU7jnzrYb4XyypHQWt3by5ln1pRbaIKXhq5Zr4PQcSGrq/wc4VC7frgi4cL+8RxP2zD2AD7+fVURrIYq/0uZ+HqzaNHbUyHvDjcKSUVocyj8vsWytd4ZGAefc0n27LzHeRbMJe3lm3KrzBhfRiRL6e1yw7bDpyRFykU/g== 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: Remove zswap_entry_cache_create and zswap_entry_cache_destroy and use kmem_cache_* function directly. Signed-off-by: Liu Shixin Reviewed-by: Christoph Hellwig --- 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;