From nobody Sun Feb 8 16:33:29 2026 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 CF1605C8E9; Tue, 20 Feb 2024 08:24:59 +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=1708417505; cv=none; b=oGlozK5egtY4bGBWsO0nkZ2aEz68fv7XHqbVVCkc932eBxWCFfBF3I1NjxK3bacOhyUFNeECCsyZLaut2LH3/1JGHVAdjVWHwiv9m8a1EqsdD2pIsptNXxkpLvHe2Eogi5V4SyNx4IfgtekfMVtEIGrIqYbxTyaJ9DAQDBUgvqU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708417505; c=relaxed/simple; bh=aGMZvL1E+Kg3YalVE1lVohFSTudazOHSLjbToygnCs0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YN2LDKeeIXU2HWGx+TR/qqtoUUaJgB6h/GawHbKXc6VE1b8AwvyoOH/h8BhUItEiPPBMza/n/ugnQVzmsGpxIshwI+dUiLR+qPF23flTZoIi8x534EIU/xdLtBGfDAzj5uC/FtQsgJ7ShdhacoXOj970uvtbYntSFRTLvu1FE+k= 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: 76a16fe503ca45c88fb8ea4a64c05306-20240220 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:87b0dffe-d672-4843-b988-436162f7c16f,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:87b0dffe-d672-4843-b988-436162f7c16f,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:d9f8fcfe-c16b-4159-a099-3b9d0558e447,B ulkID:240220153655JDMHATEQ,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_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: 76a16fe503ca45c88fb8ea4a64c05306-20240220 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1016564439; Tue, 20 Feb 2024 15:36:52 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 85748E000EBC; Tue, 20 Feb 2024 15:36:52 +0800 (CST) X-ns-mid: postfix-65D45693-91819618 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id 1C4B1E000EBD; Tue, 20 Feb 2024 15:36:51 +0800 (CST) From: Kunwu Chan To: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jiri@resnulli.us, Kunwu Chan , Michal Swiatkowski Subject: [PATCH net-next v2 1/5] net: kcm: Simplify the allocation of slab caches Date: Tue, 20 Feb 2024 15:36:42 +0800 Message-Id: <20240220073646.102033-2-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240220073646.102033-1-chentao@kylinos.cn> References: <20240220073646.102033-1-chentao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the new KMEM_CACHE() macro instead of direct kmem_cache_create to simplify the creation of SLAB caches. And change cache name from 'kcm_mux_cache' to 'kcm_mux', 'kcm_psock_cache' to 'kcm_psock'. Signed-off-by: Kunwu Chan Reviewed-by: Michal Swiatkowski --- net/kcm/kcmsock.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index 1184d40167b8..bdc3e58a9b2b 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c @@ -1877,15 +1877,11 @@ static int __init kcm_init(void) { int err =3D -ENOMEM; =20 - kcm_muxp =3D kmem_cache_create("kcm_mux_cache", - sizeof(struct kcm_mux), 0, - SLAB_HWCACHE_ALIGN, NULL); + kcm_muxp =3D KMEM_CACHE(kcm_mux, SLAB_HWCACHE_ALIGN); if (!kcm_muxp) goto fail; =20 - kcm_psockp =3D kmem_cache_create("kcm_psock_cache", - sizeof(struct kcm_psock), 0, - SLAB_HWCACHE_ALIGN, NULL); + kcm_psockp =3D KMEM_CACHE(kcm_psock, SLAB_HWCACHE_ALIGN); if (!kcm_psockp) goto fail; =20 --=20 2.39.2 From nobody Sun Feb 8 16:33:29 2026 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 8C0EA5C8E2; Tue, 20 Feb 2024 08:25:02 +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=1708417509; cv=none; b=hj/R316k7lmbCpzuGRA5FvxtHrSPLKIFoKHHxKK0X9J9ToFmwe5NJbwTLSYBftpTbXXB3R6JOthz72823kFh1xwXZMCLkMqkr+qJ/YqjhjWsdp+587p5SmwQBDFm66QHWcQjmL1gBAVd14gzYPjnSE+pUIeVLspdThGSjVyInpw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708417509; c=relaxed/simple; bh=+gpIKjjNe8+R+5iRvhPGIqKmtaT2w4KlGI3vBCIRKEA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=u0O1PFt941LM96sU8VlV5aM/Dd7jzRI5BpGw+f4G5umSB8QWnS9m7KMkst0hvlprSQD3Cdn4co95laNuhLZ0t9LbySRkFGqZ4QgxCzn2OQHaRg4M82vBgy2PxuOWQLAQpIoMxnsR3Vmh+epr2nmUfoVLT20OBH5Swgmj6I3/xHg= 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: cbb1d3fac0944f1897f3f03419695c7f-20240220 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:530f3a93-76a3-4c1c-965c-e43fbf8c287c,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:530f3a93-76a3-4c1c-965c-e43fbf8c287c,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:5ef67e8f-e2c0-40b0-a8fe-7c7e47299109,B ulkID:240220153655OTY0JWRP,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_FSI,TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD X-UUID: cbb1d3fac0944f1897f3f03419695c7f-20240220 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1545208456; Tue, 20 Feb 2024 15:36:53 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 5BFFDE000EBC; Tue, 20 Feb 2024 15:36:53 +0800 (CST) X-ns-mid: postfix-65D45695-20178919 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id 9590BE000EBD; Tue, 20 Feb 2024 15:36:52 +0800 (CST) From: Kunwu Chan To: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jiri@resnulli.us, Kunwu Chan , Michal Swiatkowski Subject: [PATCH net-next v2 2/5] ip6mr: Simplify the allocation of slab caches in ip6_mr_init Date: Tue, 20 Feb 2024 15:36:43 +0800 Message-Id: <20240220073646.102033-3-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240220073646.102033-1-chentao@kylinos.cn> References: <20240220073646.102033-1-chentao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the new KMEM_CACHE() macro instead of direct kmem_cache_create to simplify the creation of SLAB caches. And change cache name from 'ip6_mrt_cache' to 'mfc6_cache'. Signed-off-by: Kunwu Chan Reviewed-by: Michal Swiatkowski --- net/ipv6/ip6mr.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 9782c180fee6..1f19743f2540 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -1373,10 +1373,7 @@ int __init ip6_mr_init(void) { int err; =20 - mrt_cachep =3D kmem_cache_create("ip6_mrt_cache", - sizeof(struct mfc6_cache), - 0, SLAB_HWCACHE_ALIGN, - NULL); + mrt_cachep =3D KMEM_CACHE(mfc6_cache, SLAB_HWCACHE_ALIGN); if (!mrt_cachep) return -ENOMEM; =20 --=20 2.39.2 From nobody Sun Feb 8 16:33:29 2026 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 1D2BD5C8E4; Tue, 20 Feb 2024 08:24:58 +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=1708417505; cv=none; b=lwKXbdchDwQnjy4OXyLoWdpbnVYpQA1BWRgRHVli99KjLpYxhWYx4kF2mgs0TPPrdD/guDG0WgXagAhHzo93w6ScoBpol5od72+oroAGFYqsiJRDypWmJbJXtfKH5FsugyQTcNmQQE0uKkgxe1Nh0clDRNYli6L/hLpuQM0OIDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708417505; c=relaxed/simple; bh=Ewm9aE8os5thGL+1GTINypV4Lp9agL4EjjAFq7lE0iU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PZqx61zQ0l5pxVDWvkcxQFvkrqX3nLlTfPDiGzmQRQmitLo4MftGF3vh2VnG7yTUrSKY6n443XwbCFsKtTkj1JdZlRalc9Gulh2cD2dTK0XxvctrKAbioJgWKvUrG+jxHlInXXvycUgyaI8LgB6zyJQF3HosIsu+s9aZtLmIPMk= 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: 734cc8e160aa41b990c82f18d54a2885-20240220 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:eb562f8f-bc8f-4890-9270-c5c5b1a46118,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:eb562f8f-bc8f-4890-9270-c5c5b1a46118,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:60f67e8f-e2c0-40b0-a8fe-7c7e47299109,B ulkID:240220153655OTY0JWRP,BulkQuantity:1,Recheck:0,SF:66|38|24|17|19|44|1 02,TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:43,QS:nil,BEC:nil,COL :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_FSI,TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD X-UUID: 734cc8e160aa41b990c82f18d54a2885-20240220 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 113316440; Tue, 20 Feb 2024 15:36:54 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 3015AE000EBC; Tue, 20 Feb 2024 15:36:54 +0800 (CST) X-ns-mid: postfix-65D45696-2075820 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id 6A410E000EBD; Tue, 20 Feb 2024 15:36:53 +0800 (CST) From: Kunwu Chan To: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jiri@resnulli.us, Kunwu Chan , Michal Swiatkowski Subject: [PATCH net-next v2 3/5] ipmr: Simplify the allocation of slab caches Date: Tue, 20 Feb 2024 15:36:44 +0800 Message-Id: <20240220073646.102033-4-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240220073646.102033-1-chentao@kylinos.cn> References: <20240220073646.102033-1-chentao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the new KMEM_CACHE() macro instead of direct kmem_cache_create to simplify the creation of SLAB caches. And change cache name from 'ip_mrt_cache' to 'mfc_cache'. Signed-off-by: Kunwu Chan Reviewed-by: Michal Swiatkowski --- net/ipv4/ipmr.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 9d6f59531b3a..820c95bee6bb 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -3139,10 +3139,7 @@ int __init ip_mr_init(void) { int err; =20 - mrt_cachep =3D kmem_cache_create("ip_mrt_cache", - sizeof(struct mfc_cache), - 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, - NULL); + mrt_cachep =3D KMEM_CACHE(mfc_cache, SLAB_HWCACHE_ALIGN | SLAB_PANIC); =20 err =3D register_pernet_subsys(&ipmr_net_ops); if (err) --=20 2.39.2 From nobody Sun Feb 8 16:33:29 2026 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 8DEFB5C8E5; Tue, 20 Feb 2024 08:24:59 +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=1708417505; cv=none; b=EbAJ3nMFSaoUl+uRIr4RLu2fUGrxVL/w9eg6rP4dt4CpdfUDDVqbyO3YAOKviUYc2Q1RYq7hmlTojtd/x9ISm9KiRSGzN8Sm9IUUvB5Ncr73uoCs0+Fy7dEFuiktofzlDJDqfOiz51GGEnqCoKj5dMHK2H2KyhYICxvykTwRMDA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708417505; c=relaxed/simple; bh=ReuleouYnuzsUZPagxclzFw7E1W2ioD+wkHnlAUNSQc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sNNE5oOSFpAJhb/GkR/zaxP6rPvkIfOGN3l3Q8CGA1mNM0AnTU0hSE0w1cF06mQDz3lu7m7EJVjXBocjihjqWJKdm4vPGNGUKWpZWBrfP99aft1wm17iVkOe5B+vzOlTuJJMV09VScY2yJQqRpABHscy5byjcktrOHPDuFl18aE= 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: e97d3e886b344174aa31eec5022e6eb4-20240220 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:80761d99-db20-4992-a924-713ab21de6fe,IP:10, URL:0,TC:0,Content:-5,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,AC TION:release,TS:15 X-CID-INFO: VERSION:1.1.35,REQID:80761d99-db20-4992-a924-713ab21de6fe,IP:10,UR L:0,TC:0,Content:-5,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:15 X-CID-META: VersionHash:5d391d7,CLOUDID:b4fc9780-4f93-4875-95e7-8c66ea833d57,B ulkID:240220153655KYLGABEG,BulkQuantity:0,Recheck:0,SF:66|38|24|17|19|44|1 02,TC:nil,Content:0,EDM:5,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL :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_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: e97d3e886b344174aa31eec5022e6eb4-20240220 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1641455968; Tue, 20 Feb 2024 15:36:55 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 087D9E000EBC; Tue, 20 Feb 2024 15:36:55 +0800 (CST) X-ns-mid: postfix-65D45696-85943521 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id 40744E000EBD; Tue, 20 Feb 2024 15:36:54 +0800 (CST) From: Kunwu Chan To: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jiri@resnulli.us, Kunwu Chan , Michal Swiatkowski Subject: [PATCH net-next v2 4/5] ipv4: Simplify the allocation of slab caches in ip_rt_init Date: Tue, 20 Feb 2024 15:36:45 +0800 Message-Id: <20240220073646.102033-5-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240220073646.102033-1-chentao@kylinos.cn> References: <20240220073646.102033-1-chentao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the new KMEM_CACHE() macro instead of direct kmem_cache_create to simplify the creation of SLAB caches. And change cache name from 'ip_dst_cache' to 'rtable'. Signed-off-by: Kunwu Chan Reviewed-by: Michal Swiatkowski --- net/ipv4/route.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 16615d107cf0..b512288d6fcc 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -3693,9 +3693,8 @@ int __init ip_rt_init(void) panic("IP: failed to allocate ip_rt_acct\n"); #endif =20 - ipv4_dst_ops.kmem_cachep =3D - kmem_cache_create("ip_dst_cache", sizeof(struct rtable), 0, - SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); + ipv4_dst_ops.kmem_cachep =3D KMEM_CACHE(rtable, + SLAB_HWCACHE_ALIGN | SLAB_PANIC); =20 ipv4_dst_blackhole_ops.kmem_cachep =3D ipv4_dst_ops.kmem_cachep; =20 --=20 2.39.2 From nobody Sun Feb 8 16:33:29 2026 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 CF1AA5C8EA; Tue, 20 Feb 2024 08:24:59 +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=1708417505; cv=none; b=eiyGjFac044jPM7vsgvUMsLHTu/EuN200kjBzTWThvHw0Y3FubBb07WMbKggIbUaeeWTnz1mMI8ca3V38Gwo2382TVLwhOfkkf9PPxDL9OpaLWaDrknLW3bBebPa070wlpueomBQe8jDX4tp8ZivuvX2RC+T4PUou2Qmzy6Q6no= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708417505; c=relaxed/simple; bh=+w+mRN6Xuei5AS2KampiNpZLGpy3MvgpnukzVAOQA24=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=scK/xk9GiduNw4p577SS93QHTtIBGfvXAzcEov+XNAzcqyQ5fQ2TqAgyOHSQVSfRrImoiFtqNHHEvBFP2tJBMUmqG1MRArdHqvJz+Hm0wTMuc87DgRuencHiROi5tNC35dBCn6S0T/JUU/DJyI7OC2OB4baNi+qybXvQxPTECOg= 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: e76ac4262ba44dd3adedc0eb3e9b2ca8-20240220 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:db588860-89b4-42ab-9066-b37eb2441484,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:db588860-89b4-42ab-9066-b37eb2441484,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:b6121884-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:240220153658NWT9W1ND,BulkQuantity:0,Recheck:0,SF:17|19|44|66|38|24|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_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: e76ac4262ba44dd3adedc0eb3e9b2ca8-20240220 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 2003651422; Tue, 20 Feb 2024 15:36:56 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id D0490E000EBC; Tue, 20 Feb 2024 15:36:55 +0800 (CST) X-ns-mid: postfix-65D45697-68413322 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id 187D8E000EBD; Tue, 20 Feb 2024 15:36:55 +0800 (CST) From: Kunwu Chan To: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jiri@resnulli.us, Kunwu Chan , Michal Swiatkowski Subject: [PATCH net-next v2 5/5] ipv6: Simplify the allocation of slab caches Date: Tue, 20 Feb 2024 15:36:46 +0800 Message-Id: <20240220073646.102033-6-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240220073646.102033-1-chentao@kylinos.cn> References: <20240220073646.102033-1-chentao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the new KMEM_CACHE() macro instead of direct kmem_cache_create to simplify the creation of SLAB caches. Signed-off-by: Kunwu Chan Reviewed-by: Michal Swiatkowski --- net/ipv6/ip6_fib.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 4fc2cae0d116..25d7e6d45e6a 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -2444,10 +2444,8 @@ int __init fib6_init(void) { int ret =3D -ENOMEM; =20 - fib6_node_kmem =3D kmem_cache_create("fib6_nodes", - sizeof(struct fib6_node), 0, - SLAB_HWCACHE_ALIGN | SLAB_ACCOUNT, - NULL); + fib6_node_kmem =3D KMEM_CACHE(fib6_node, + SLAB_HWCACHE_ALIGN | SLAB_ACCOUNT); if (!fib6_node_kmem) goto out; =20 --=20 2.39.2