From patchwork Mon Apr 3 12:13:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 13198068 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 158F8C77B60 for ; Mon, 3 Apr 2023 11:23:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6EE9E6B0074; Mon, 3 Apr 2023 07:23:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 515F16B0078; Mon, 3 Apr 2023 07:23:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 30CF86B007D; Mon, 3 Apr 2023 07:23:25 -0400 (EDT) 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 0F1406B0075 for ; Mon, 3 Apr 2023 07:23:25 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AD675C0978 for ; Mon, 3 Apr 2023 11:23:24 +0000 (UTC) X-FDA: 80639843928.29.27A3ED6 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf04.hostedemail.com (Postfix) with ESMTP id 467834000F for ; Mon, 3 Apr 2023 11:23:20 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=liushixin2@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680521002; 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=DZ/SUniV1JtRkr7SINojZDbyN4/r+Vf3/yK5HT+Jekw=; b=8F2/LX8lkjzfe2CjQogYw0P4wPpBsIOw2OYpZNGDzb1HNJ+VEtUjre8AOq4bg65UJmNuH1 3a6IXjZV21Q0KeKdGuF9Zo8aHfBP0dqu42IrDZM89LjLME/zOpJZvPkLwsn2/jDa2+CLv0 PUZwsLRAvFsPp9JDbpakk6hvqkou6t0= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=liushixin2@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680521002; a=rsa-sha256; cv=none; b=kdKyQPm6KgRh9hnPg3uyrNyXj8Dt50TbWp/M8n9ydVEMqg1M4omaSZvV9C8hkAwHInmhF9 1A2CIBpQwps9Ab8ma4ZQxnWE0WNlb8xZ/L0bYon5EDgQRsB8TbX6fhneEFO6TO6itgXkxy 5u+Vju0StMxxyeCkOfToVKQxhmcF1qY= Received: from dggpemm100009.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PqpM90v61zSqnD; Mon, 3 Apr 2023 19:19:33 +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.23; Mon, 3 Apr 2023 19:23:15 +0800 From: Liu Shixin To: Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton , Nathan Chancellor , Christoph Hellwig CC: , , Liu Shixin Subject: [PATCH -next v8 1/3] mm/zswap: remove zswap_entry_cache_{create,destroy} helper function Date: Mon, 3 Apr 2023 20:13:16 +0800 Message-ID: <20230403121318.1876082-2-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230403121318.1876082-1-liushixin2@huawei.com> References: <20230403121318.1876082-1-liushixin2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 467834000F X-Stat-Signature: ub5uehrs4qmg1gybb53dykfmx73o43os X-HE-Tag: 1680521000-240813 X-HE-Meta: U2FsdGVkX19BdpE5rUGoP0ipp20oxOAFL12zRJmLyZT9Q+myFY/CUmK4CSdZdsRJHGYU1tb0fbO1t4F+swqrHqHWQj2DPwy739ews6qW/Kk31fmClGkxUqOMfDtRo7WPWPoeRd+gKfaGV1MpKXF82cYlX7wa69+8rZufvnj23TNLBr++m6V0b0ULmVY13GscoTlifm28bR7ywCyE9pIegecQgOuZGhUuguKyLn+cqvlbgy76Q8MkgAipO+ItRyv4cEJeJNO4Y0K/6qsWz9NiLdwYMBDPmbtslrRoC4E4VNbD30SSVf6j9TTEkdFPQS1bYHd9GhcLYusilSZOsKkdAQacwYZiEytZICbCrajlibrVgF+BcP6qhcRp1DAExUpxm8E0JWII8/1cEVxsZdakaIt3xucPKXnBanFFVmXFMu2pl983wnjE+QBoqMwDQ1O3rJES4wHXcUOEsJeQUOlmRD4/RwuDUvPOa3gz+i5WU7Alf1ZsfDPJu7wU21z7St78ym7NXW3NaAgr68SYru1TBhwyP42UvjDt8QTIV/Ts+T1R+MKOPpZgFOu2NtK8FLnGgCT7Omu2XCfhBPPqa1Pdl//Atq/BftrJ/afrxTLPWBLmLsk78s/T8FSSPggy4uW0Zskjp5EDW61hW5Hgm6vSsBNF9r2Z8YRDS0nhgNbd3wCEphE+e4gHlNXYd9PO7US7pWsx6LbAErJgaxGHAVQE8ROlJP4Cn6WG9byqcxuyereYl9rR2FOY8b0pmGjS/V9wkzbLzyNyChCnI2nq8UyaGvksBO2yW73DSQPTRzYxszi/eqBhuVJ7jLtxazYul+a3bvEx+ajF5O/WMDDnKksQ8PnDW/E55ScpP3/3I08kv9OoStgd89IdNeI+R1nKUHx01q0z1wrSt5H6cW2thqfrwr3KgJiwqQtN7B9I7kTLRkHvHucldBUpsV0ZhupqpjK4NyfTq33voUVF+H3DatX rXG3xgxJ u4PNR2uMEk/ws3jr9mt/pzRI2YEWNoP2KCtpvzGx8xUi3+2VPEnBON3TdC5CYLY2gmtkxI8GqSVjuSvJChh/zDCJzgCMM7KiANKNUfTltxFhUkI6j8kATbtnImVKykrumQQUjQy45Fi2G2T44N7CrnXxvemZbK0Qg81hpti2LVMuqcODV2xtU274orwGmYtbo1lADDHWnVggOix53BT4OQhW0bA== 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;