From patchwork Tue Jan 23 02:46:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunwu Chan X-Patchwork-Id: 190692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp87139dyi; Mon, 22 Jan 2024 18:47:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4zt6SUAeaYqe6kVpfuFgG8/vjJsH5i81Si5QghUgqH1/fwcMNHxA5se7ctb38KhjITtiq X-Received: by 2002:a0c:e44e:0:b0:685:2e12:94cc with SMTP id d14-20020a0ce44e000000b006852e1294ccmr221334qvm.36.1705978031281; Mon, 22 Jan 2024 18:47:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705978031; cv=pass; d=google.com; s=arc-20160816; b=bnITyAcx93o0GJ2ke9llm9ennvo8cmbmghDoQOZNmGOuoQkwsCr7Kt/bbsZ3KKe1FQ RkN1O+jTQZW2dupbmaNWqeKoxNkL2mfkwZ/ZHP1Zm47q7PsdFPNw99Yt3cqdyVhSXYSV egmk3c17ie+IxfzNGFkVkJmf8ByT8kGMNg/w5oyf2+mO6GilneIdTRiFAHsQVaHCBZT4 CRSuvk+S2l4ej3x6FZmzrv8c00IbnlBV0UlLnd4wxKuUtWqGg9EQFYWMzLPtrC1CibpW pHjPQYc8105l1aTOWLaEaMyLGRhSeU0pmBK871poCKcN6FYBrHg3D4+5a5zEwnIj0GPs C57w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=q+0oPhnh8x9ZDBPaglHHx9ak+KdIQEuyNRY+VOF+UDY=; fh=A3wk83PZnralrrCkvnvQjrz/EdwznkZROqIaWZsMnig=; b=QArOrqfpxZkgwaBqHqu8y5kUUEeTOHsAqj3h1BMN1L/MkHHfODFa+E8WT1iss4MXf1 55n6cuREo/duE0s4xLuYPz6sjGAfKywXFzYUC0854rxnbXAKQ/bWV/fWrsmdWksW0aUG aLLXGmQpsJEwaQMX7eNh9fe00nza4fnTdaB41DxERg+jRFdmrV/J3rQILDzyFPxLy5Pm /ld0fX62qUbDnL+QI2xUytuaDB1vCiuS3uDBOeqKaGNSIMTO6potdv3zsPNKoGBd+pDG WztADUce01UoczYIj1ZrnUtUvtBk7zbTO/YDGa5+xIY8Z5qOTaXCbaG3J6vOTnMpiGuD UXcw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-34648-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34648-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id t25-20020a0cb399000000b0067f9f28533asi7382204qve.505.2024.01.22.18.47.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 18:47:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34648-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-34648-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34648-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 153CE1C28C66 for ; Tue, 23 Jan 2024 02:47:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 27A351C3E; Tue, 23 Jan 2024 02:46:50 +0000 (UTC) Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 069B4374; Tue, 23 Jan 2024 02:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705978008; cv=none; b=phRw/aHvUmARoZFX4aMo/1JLqEpJK0UmzrWl8tFcB2nC/9EN3Kq1FrMPJZdpA8VzJs3Q7nuEwJwTuVqYdJBhzkQJYnHCT7qcvyzcUtcpvern3eHIO8vmpbUXmJM9GqPz0bYh5j7qXpTULUkdtzPdX8VyYEslkVataX5cnczDVG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705978008; c=relaxed/simple; bh=DgpW2TYFY7FMhpYd9iFluKaHz62UIxRSWXxq6QZHrPQ=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=KFU1CkJkbishRyIWFdTJlBqaVEomazu8obgyR2uJwehuir/E0eQSGs0c923EnSz7n0DmxcthNNTiRrtnAfJj0kZsS8Oozybj8eG5w8dvSNcQittmkOKDhiyvt/j3zFHgxQ1oMWIZuqsRDsr5N6oYypiKl6F/ChxKv1a5OER/oyg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 5d505d236484480a9e29728173f68199-20240123 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:3ae40562-b553-4881-b1b2-749a43e648c9,IP:10, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:-5 X-CID-INFO: VERSION:1.1.35,REQID:3ae40562-b553-4881-b1b2-749a43e648c9,IP:10,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:5d391d7,CLOUDID:457fa47f-4f93-4875-95e7-8c66ea833d57,B ulkID:240123104638C5ZVN90J,BulkQuantity:0,Recheck:0,SF:44|66|38|24|17|19|1 02,TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,CO L:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI,TF_CID_SPAM_SNR X-UUID: 5d505d236484480a9e29728173f68199-20240123 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 2008426615; Tue, 23 Jan 2024 10:46:37 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 100C8E000EB9; Tue, 23 Jan 2024 10:46:37 +0800 (CST) X-ns-mid: postfix-65AF288C-825111420 Received: from kernel.. (unknown [172.20.15.234]) by mail.kylinos.cn (NSMail) with ESMTPA id 379ACE000EB9; Tue, 23 Jan 2024 10:46:33 +0800 (CST) From: Kunwu Chan To: pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: horms@kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan Subject: [PATCH nf-next] netfilter: nf_conncount: Use KMEM_CACHE instead of kmem_cache_create() Date: Tue, 23 Jan 2024 10:46:31 +0800 Message-Id: <20240123024631.396631-1-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788847620301657015 X-GMAIL-MSGID: 1788847620301657015 Use the new KMEM_CACHE() macro instead of direct kmem_cache_create to simplify the creation of SLAB caches. Signed-off-by: Kunwu Chan --- net/netfilter/nf_conncount.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c index 5d8ed6c90b7e..8715617b02fe 100644 --- a/net/netfilter/nf_conncount.c +++ b/net/netfilter/nf_conncount.c @@ -605,15 +605,11 @@ static int __init nf_conncount_modinit(void) for (i = 0; i < CONNCOUNT_SLOTS; ++i) spin_lock_init(&nf_conncount_locks[i]); - conncount_conn_cachep = kmem_cache_create("nf_conncount_tuple", - sizeof(struct nf_conncount_tuple), - 0, 0, NULL); + conncount_conn_cachep = KMEM_CACHE(nf_conncount_tuple, 0); if (!conncount_conn_cachep) return -ENOMEM; - conncount_rb_cachep = kmem_cache_create("nf_conncount_rb", - sizeof(struct nf_conncount_rb), - 0, 0, NULL); + conncount_rb_cachep = KMEM_CACHE(nf_conncount_rb, 0); if (!conncount_rb_cachep) { kmem_cache_destroy(conncount_conn_cachep); return -ENOMEM;