From patchwork Thu Aug 22 02:27:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Zhen X-Patchwork-Id: 13772494 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 63131C52D7C for ; Thu, 22 Aug 2024 02:32:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8767A6B0179; Wed, 21 Aug 2024 22:32:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 81B356B017C; Wed, 21 Aug 2024 22:32:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 66DFD6B017D; Wed, 21 Aug 2024 22:32:49 -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 439B56B0179 for ; Wed, 21 Aug 2024 22:32:49 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C292A1411B0 for ; Thu, 22 Aug 2024 02:32:48 +0000 (UTC) X-FDA: 82478308416.16.F324537 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2071.outbound.protection.outlook.com [40.107.117.71]) by imf29.hostedemail.com (Postfix) with ESMTP id CEEDC12000B for ; Thu, 22 Aug 2024 02:32:44 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=iNl9RF7U; spf=pass (imf29.hostedemail.com: domain of yanzhen@vivo.com designates 40.107.117.71 as permitted sender) smtp.mailfrom=yanzhen@vivo.com; dmarc=pass (policy=quarantine) header.from=vivo.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724293858; 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: references:dkim-signature; bh=4yZVl83JrJFaDRsKTNAbd8Az1qepEJrUYlr84LdAsxY=; b=8Ml8wrJGiwat1EnKSnS+YS0w/NmfWnJK3wnn3TCt2Q38gxCnWIb0Vz5kWqPmdhiB7Zme0m 0IAQ7JX8cQUxEYpXggNfzokqkpK7k0on8Mxng6+lMOUx8p4Xv2Tjwr5f3NtINQMuPEzFCJ +6alq+AiwoA2vkD+k9ljoy9UdWWWul4= ARC-Authentication-Results: i=2; imf29.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=iNl9RF7U; spf=pass (imf29.hostedemail.com: domain of yanzhen@vivo.com designates 40.107.117.71 as permitted sender) smtp.mailfrom=yanzhen@vivo.com; dmarc=pass (policy=quarantine) header.from=vivo.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1724293858; a=rsa-sha256; cv=pass; b=wAN8gS19GTHtfDSjWb1j0kwGA9BvTDR1ivjYifPbOnAaME2VpyNovYVbJcA1O3v+J1i1u3 Z/RdJeEGAqbvX3ufrF5Vbfuh9ghyH8oqmXUlm/4GaiHsS2l3EVXbkK6Uv39z4Uxm6A6iI7 bF3DpxgRJfB7lIhfHsmZYMGKrKHlSrk= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=O1GdJS+3J9uUHXDv2sP5G1QpWvPU2dUNEXpnsWIB+llftEFl+JeEd7EwNcoJH0fK6GKJYeGqHHTrx92vVSgsiAC9UgjDd0VTfeo6q/qixyXtbTtmIlkgjw7hFnT3pYNIzp5r/GglS3sHbDjpNvyoWvmalWpuMahSzHiG4zHV4KopYlEGl4bkO8w5sfdoWmVap53n23KyjGb08q/6T9je59EGA1T+PCsN/D+A5HvesFZg8PUhaQGREygJYTGJroX4IL7TCU9Zw6AvSW9GQndc2fW2CZ1+zlFhQntosv9H/NGZpxRhWSJA0dFAU+wWxnpdehR0aItYIjHjA+kXw50eCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4yZVl83JrJFaDRsKTNAbd8Az1qepEJrUYlr84LdAsxY=; b=ln3KFDcIT3RNxOL7sWc8ImEC7NN2iHh4B4UFFujDC9OxJa4cbJ8kurPNJ76JevQoYoErPypEOK4EoUiR+pwNm2Zxxb56kG2p96tMfY5VSRV7yN/1KgbwKRvsRe+UBnG0qTcRUgX7kdi+acHD7ebmw4o516n5/+0oEuYiIGX97X/P8vSYGjekyssHYQQQquISR/wY4LCi69TOrSTcOyo3WavahQRVaPLcQ1LLRhgenYrHyvfQzak7cMBLgNLD2wLFqs2ZX8peAuTvajLiOVENHlfkXGiEKDxUHPBBedUQWF6DJmvxXQ9i/5ypd959ArKATMiUB9Aa7fW9RGExLuAVog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4yZVl83JrJFaDRsKTNAbd8Az1qepEJrUYlr84LdAsxY=; b=iNl9RF7UHJMAH9iKuUmkoNEpoyl/j9a7tX/FEoGLti7/+2pMv847mOUJ8FMN5k8hNsMHygN5eq8D3Z7noh6wlEiLk1fvYnQ6m2+RBOMVLbblxOPzil51TnC08IHJansx3m+6O8GxUZM8cEBLd7IDghknY158W+OSA2euA5X31Aua5U+irw+FK1OpstBSQY8GBGsiuEg0HhlXKgrPEh5L/QzWOix1O0uc9tiOJYJFtwW7KYmv6GGCYkgDOgLZ0kosXiOnftvDRkVk5gHnWq97J4PfuqscHIzIye7VwI1vzEyZ/7c5cXh/RMMcE02GjkC3ruGpPZy8Y4yqMYLBeKF/Jg== Received: from KL1PR0601MB4113.apcprd06.prod.outlook.com (2603:1096:820:31::7) by PUZPR06MB6187.apcprd06.prod.outlook.com (2603:1096:301:107::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.25; Thu, 22 Aug 2024 02:32:36 +0000 Received: from KL1PR0601MB4113.apcprd06.prod.outlook.com ([fe80::7e85:dad0:3f7:78a1]) by KL1PR0601MB4113.apcprd06.prod.outlook.com ([fe80::7e85:dad0:3f7:78a1%4]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 02:32:36 +0000 From: Yan Zhen To: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, vbabka@suse.cz Cc: roman.gushchin@linux.dev, 42.hyeyoo@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com, Yan Zhen Subject: [PATCH v1] mm:slab:use kmem_cache_free() to free Date: Thu, 22 Aug 2024 10:27:04 +0800 Message-Id: <20240822022704.1195439-1-yanzhen@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TYCP286CA0001.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::7) To KL1PR0601MB4113.apcprd06.prod.outlook.com (2603:1096:820:31::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB4113:EE_|PUZPR06MB6187:EE_ X-MS-Office365-Filtering-Correlation-Id: 73b4fabe-9699-4ddf-acea-08dcc252af19 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: kWB6uqKqDKRvF1gZCN0p/PklZXg2r49lQ35uaJ61dGkwpG8mbNqdZjwe/juy0v0legEXr/o7X4US9lkXES33xeRRJ51ySMKhPevzAaWLNuBnAXreJNOb8H0jssFpDIplwAa2SV6IZS9rz62hyFCUqQWxQ9Q053MIRG29QkxcRBaK82za3P7Rp3oRJolyyTSH1H0QZ8ZEmQ5MINK1ohaivXZVtuoajrXFXEG9+pg+KVhXP2kiZBd+5rplr282IUEjIWoGTcq1YP7iE1yfZU9G1gRzhJ527tpqBO3VdxtE4tx1yBFBVKWOtnp4kDq+8tYRGo5a81epFIrYkz8xJ18v3Ov2KWtBGLOq/QfizMv04bAWfX/uCqmmod9wOO6nan5QuZ3iqjhXRgG6vt97fEtvto8ls5V5QEaTUBSK+x+XPaSVmbhdY3jXfG2XkX/oFg++zI8mr3zYgkQINm1P2/TUNP7QCLCmiWzhZUgF6tZoVaySxDUNrSWP3gJ3kiucDtLRPRBH1ubz8etLdCC/dfIwq3E3Kw/gazpgHfZm8+tBTlBuedMjXCab+tgzzFSiRnw1VAAexE9ncX73rsG3ysIxXEVpt83MGaiuFep5O7DmyfKircmAK0ffMVEODOyle1ZUTZHDW2sEhLf0UNGY3o4UfPKSI6RLbrZFiECj31F6l80oK1fF20I5d4Gq4Wfo/ZY3/rSMzSh9Xq6TZ+31/SREnY+eiQWAfJluWwyPNdVf6mLCaopLeZrYVdoRbIgvmzByWH1+7NZJ+u/rvCkBFRxjP5r5fXpj/2xtXovRR4X9kmNs2aaSBd0DV99Lv6MZRk/QGmvf1xqIoEDdDg77eBXJluSKCJOR0YeDAmMzdgm0uisH4GQ2TFxf6BYH5WhNSjTjiabWdP/Gbt5qPeG/XnRbKJFtfTDtwwe2zEYcOQzl0IV0xpTXbdOonEcjRg1fgp5S4LxY0dDNBxkFILS3Tf7oMA1QAbbW5Su/pkiitV2CH5+w1qrnMWruFpLvHzAIQ6OTmgYZH0O6FWJs0pGGGFrMkdlv58uG3fNIxpPVWZlx35cegEZ0UKeKDsnPmKgpzrxyjFVfA1GdDtcGSRMgatU/Xl8LruQdFWFMVY3kssZ8U4/onDy0Rjo31UyODLYULAsgUXMkoHDeZt+A4m7QtxSLTIUrG6jAsrnA/O8xePIFrxk/lXGMggS1b0zrBqMx2+6DFVbsIILLqXZ61pvSKCqRCoVbTgRpzTMfY0yJ9DNN8N7YpBzkOVTDBNfr60OI/QW07cQpLqjPg40IUadHs+jRyZl24Ta0uhhHxSZyVNjmlsxvHtQYYpOP13N9BDWSn3c/0blwDt6cQsECVS0yyesgxLSN3rK7rRVVGjMzG+HzWfYGTl+6jF9xqlrNhQZvlUWdWvOT3KfOJaV+eDy0QOZc9w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:KL1PR0601MB4113.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(366016)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6N93Zmd8pZPu2l+X2pvepRy5gyJudE91sSsYPKOIWn1HQl+51YktRHCUf1YjcSCvz3bBf8LwYd3YjZX7dRBCJ1nfCwQbJwIqLLxDznzPk2LrXu7+AtgRq3mr7KDlmHwJFXoqd3h9P14zfNZTpXbW+V7uAGrLKmp9903PeK7PqXsPbW+NsMTcVP8jtYOHs9Ec0HFRZxCSSfBtOAB/wm/fZV7b/g9G1VLEll/AgwGWEcar9HLQ7xzwSEKQF9ZlzeBxURUPRf3jFm4UoV5nC1C2T9cx1Nxq6djej60z3iX4r8+e1l6QMyPxN8/r+udNpHjK06gcXsk4NZAvcKGFfgEL08fJqJI7TwCya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Pwd9NfyMjyVCi4ykvkNZ/If8NyUfumIa3B+YBAteuQ5JvZ1Ubc0R8Es1bmFCWQKopOzD7Yw6adB65k8UY+XC+rGD2ws+vWn9FLykDFgurioZPFwCxlc53+HFueOc/UcXnoXlHfeR9js8jvdF0sCSWNKxq X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73b4fabe-9699-4ddf-acea-08dcc252af19 X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB4113.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 02:32:36.2711 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dLlUINiBdPUKBV8GBCucOHVgFuo2D5EEoXncSPJj09BCPS30aXkM1U4vqrGE7danJVN0wTLW69w1ikiup4fkHw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB6187 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: CEEDC12000B X-Stat-Signature: g1wgi76wozh3ythqd6ppzyn9zymszxbu X-Rspam-User: X-HE-Tag: 1724293964-732424 X-HE-Meta: U2FsdGVkX1/rKjkcmoLH9QY1dLvhAQG9p02+wGYMLl+I6yHJQxcMokKy9eayZPt+wilxEAhZ4CavJke3blyOuvyROTal5HDgod6ZqDH3Kd4B1Wq6TLOhD2ZKM5qkT0nxbjJJ8s7UK6wykRMN/AbYW/vh3a6c/Vyv05qYPyAOc6f/IAVg0OK9zu2i7GRWnMzU8OZsLdW9ExzS4TwTnVEerZSZM9AK/RdACiDAnXMfFoprYaoQfuW6MGRxTdSS8eylNEaJ6cDW+5yv3qNyukGQXWBwqQvkzlvIDqNWHrxeRcapJnkboIpXgMpVGcpTk/2evGIbqiwT0ZAvQeYdr+aaQPYRgOKab4gf2hLDg6aHWz9YclXjBsqX8Mp6oWFBHDhUOcmebfscSuHkVE1/xyHrSn7VhqVAXJ5ZGfLqlOvwN7i0AttV40CGhAKd2D/cDYEMFNrE2zXdl7XGl8epBjDv4+JMbJfVZm/ddJVL/Fh35Zuq+W4npKW3FtMSOW/Y3bOUUyrMdQFZ7L6GjtRiPpIIRs0X7Uubt8NGnpg+WWsSajzWHapzXViqeRFMruBnObXf2lkgmTZYDnhd10XiVBa32APfwq6xovtscf1cyaroSoZgOcskimRP9OKumcv9/gfUBAw4pLKqpYkwId2tUmy0O2FSNpBXhe2OZbp5rc5zenQkLQUFYn+ZoX12iSZgBwHpg41hjhQu4iO8pVf5w1StMdgi1YcD00UHh3xPGWVl1fx/6ziZvmeWumIuGD3wAzr2S8ScXIoJLiaduuzXmmEf1pX/tS9zyenu+mqpm8xEQxVA0HnEzsfrU5XiYO5wCm5yegdrCStzEwq8/EBLZgI4SdGk994uExJQGxEciFNGdgZONHbm6jdUDN+r99oe22CGHr5kpVoDfT3kpZjwBd5lubCZJqj6hZmei0bBVYxYYo78VYgfz29D/CMjFnN0Lla8FWb9cYlz2aiFGBSoxug rLVmurA8 R2A2g5FHus7EzHOamH/y1HGCd69FgycUmKvN8uP2cT1FBQShjRUT5Gc8Vti5sas9aTS1u+4zjWS+7cXd1kUIzcyNf2aGU2oUwOlSdrQUg1aLUyoHiuiB8hTbDt4bjYUxw/fIy7xMHHZx7zYNum03SgDfej0MLaoSPy5yN8XqOBy07PcFYJjt3roVjntzL+mib4E+0er4grKBQuB0HstR7gVetvSNhz6B2LVNRfjIUitvYi1VkQLosv7cKPbqSjcwWpdMOzz5lWuXmUvNon9MkyGjI2CS9K1XESIqLSpEvIb1/WIqFrC4o/5cI5EMhRp6fx3kI4p9ZMCgMVxYayzu3BtGMXv6CMSazwAujBR+kXRtBHE/AEi4T6J36/A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000045, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The kmem_cache_alloc() is typically used to free memory allocated through the kernel memory cache (slab allocator). Using kmem_cache_free() for deallocation may be more reasonable. Signed-off-by: Yan Zhen Reviewed-by: Christoph Lameter --- mm/slab_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index da1b00665..0463df45e 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -491,7 +491,7 @@ kmem_buckets *kmem_buckets_create(const char *name, slab_flags_t flags, fail: for (idx = 0; idx < ARRAY_SIZE(kmalloc_caches[KMALLOC_NORMAL]); idx++) kmem_cache_destroy((*b)[idx]); - kfree(b); + kmem_cache_free(kmem_buckets_cache, b); return NULL; }