From patchwork Tue Apr 11 09:36:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 13207216 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 BE93EC7619A for ; Tue, 11 Apr 2023 08:46:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 44C196B0114; Tue, 11 Apr 2023 04:46:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FB446B0116; Tue, 11 Apr 2023 04:46:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 201EF28005E; Tue, 11 Apr 2023 04:46:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id EF99C28005D for ; Tue, 11 Apr 2023 04:46:38 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B3B2B120B14 for ; Tue, 11 Apr 2023 08:46:38 +0000 (UTC) X-FDA: 80668479276.25.DCF106E Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf21.hostedemail.com (Postfix) with ESMTP id 3E55F1C0002 for ; Tue, 11 Apr 2023 08:46:35 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.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=1681202796; 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=1Kj+yFx2zr3Tp5uKSF/uRbC20N56l1saULZmqmtktBsBI7xMSzrJJJWrsiwRYc/4dVfw7l Sa91vo3O7ZIuu8vbQvS3aDWKn9vNgf7oN0e7+7Vw4moL/IJiNQLTU2+EAMCS2MmCckN0ol udurTiwJQ0MLODofeQFOZhUSvPVRhFc= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.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=1681202796; a=rsa-sha256; cv=none; b=5mQFDeYkeh2J/nMT8IPXbq6xLG4p0CrfRPs5whxKBlUprQdEukHTqxLqWTkgQkatlyjyFa Mjx89YgdaUpJGZ95VWsaczD9n3No9GibvCk/7TJrs14x4CctZO7ONDWYxl7ZpbIcqWVLwv aYKguFWjN5mJXWjX6EfnMCvLdsBSNq8= Received: from dggpemm100009.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PwfWx0VJRzKxn9; Tue, 11 Apr 2023 16:43:57 +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; Tue, 11 Apr 2023 16:46:30 +0800 From: Liu Shixin To: Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton , Nathan Chancellor , Christoph Hellwig CC: , , Liu Shixin 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 Message-ID: <20230411093632.822290-2-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411093632.822290-1-liushixin2@huawei.com> References: <20230411093632.822290-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: rspam04 X-Rspamd-Queue-Id: 3E55F1C0002 X-Stat-Signature: 9j3eofi1yystrg9qfm4dcqidszce91c9 X-HE-Tag: 1681202795-768284 X-HE-Meta: U2FsdGVkX19fnwY11VF5qcmSVMmEb6uK88hPxvx9UhsTIXOsqhmixlywEenQvbKV0J41/8+o4Jabw65VkfuUCMmgmZWmva7Iv1QYZVQjVbAdU9e993GO8aJol1gSZdhhBci8pGlEfRly0toFenkmpgnb/gdMVLH5S6E8t+IYykM3L84DLt+zG6DD9daQShwoCZLBOXp5wMAlvEusHzUHFMzUpoCxu0z2e4Q9Ax+YRtLfvjhwvTj6B4HYOFpJN9n5JzlWtVgFa5StbBEz/PiUVyzKyTj9HYE0Xi7pj7Dv5WFa1uQBztJoAk/iR2rY1rTstTbYaMJzOU7BmCSB7eIDxnuf8Md40+JpB7EQnoNAbsWT8OFXRnvbfldtqNQ3gdx9qBF9bkY97VnVTPvs6xjtFCHB+/eAI92iVIwOfEzisrmI/KI4Xyi0APVDjYCWoL3tW2uV/LDIEDJTTiNp8m7HAWWPA+IhsAanB3LdjL0ZFivtmI6wTlFM2cJfPNWtRcgfGZST21aE20hOV4ePk+UkdcyE6mKe6OKXqW+l3/79YlVjh+uOXqTe+9NqmOdaPOiHtyUD8VeU5UBvqVjgRSVAFq3gFM+OQRBnafPCKk/o44OFJallogUdrmgZhCBdp/C3a2V2ilQuTrj/33ro1LbkKjs6KUZajTd00E3P7u8xUZnFkaeZMqd0HsvYEcLE9gYVkoakAmEFcyOD+TMHz07TXt9IVRClIX2JMt3RCuCpsHjZIjf+7SWDLfWg3wtFmH/utC+fIT7B/cE0a6EFfhGmu2LJbZsojjsTSx7w/y7rqTfAzEZmbMDrdomUrFvdfSJwU5Ssi8Es8P3WAfFLpGjUhTPxMind1nwuwJRlC7/VdEwYOtIwGpxU6wlm9ZAgx17kkDwADRa2zx9xqgN9ZYdSIBQIxywkvFSyxrid1uqZ10cRH6bbBEjjS8ajpahc6AMwaPn4qN3eDB+gUzxf+LP nbBIZo1R iJAtZmYliF2f+jwTffy56TZBJWAgmumwtuCr5Yt6vm5mi3A/5M910p21xbtyXiQx/FkmGTp80oAYV2ZD9m16QjgQnydv1e0qm4spegXZlNmkyW/aQGTng6Wi9W+WVO2zcCvaMM7H0exTRKxC+LIGFsB4l8DOfKVdz0sGDCsyYISrYy+/IPBc3O+yarD5YbIciYDFWjuMdgf/Qnb9f3zQ772P7ig== 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;