From patchwork Mon Feb 5 07:20:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunwu Chan X-Patchwork-Id: 13545031 X-Patchwork-Delegate: kuba@kernel.org 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 0324A12E63; Mon, 5 Feb 2024 07:20: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=1707117645; cv=none; b=OTzT0p2NPRKU6nLJTTcxYgoe++ROJyKla5xAcZydgQPBLy0iGy4QTK9lBsqtOt0CxGsB+OZx2w05mKLccXS2IHqNE8+o2QXdGkiiWhj3G0xk5GRy/MEFuNVpFCU5zsov77C3QebmfDSo550tXWdGxLAJFpcGpU4YWqtf/4U8vI4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707117645; c=relaxed/simple; bh=YN1aQFZ5Zc8+LiztBiUiibV+CuZKGEL0EVvyyuJVySg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ok9LPLpEq8bSRVR2+cPg55goWnC4uHr0mIo6u6Ksl8WCll5z1u3dxo0BgkFkOTkqA9DyUdJTNUUFsdlPsUwhRxXnPC9YjWu6TbSUZJp//4Q/bdShaAIKBZcR95JVJKjj6YVSVnRqwQWu8RrGcOn27xTq5n+sSL6m59+tPB0xocI= 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: eb5a048872ba4ac0ada8276a0bb8a711-20240205 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:5f8fd22c-67ce-4c69-84ab-7d6c2786cf4f,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:5f8fd22c-67ce-4c69-84ab-7d6c2786cf4f,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:4bd12080-4f93-4875-95e7-8c66ea833d57,B ulkID:240205152038WUMG2LHW,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: eb5a048872ba4ac0ada8276a0bb8a711-20240205 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1267139241; Mon, 05 Feb 2024 15:20:36 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 942C9E000EBC; Mon, 5 Feb 2024 15:20:36 +0800 (CST) X-ns-mid: postfix-65C08C44-40680673 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id 9C61EE000EBC; Mon, 5 Feb 2024 15:20:33 +0800 (CST) From: Kunwu Chan To: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jiri@resnulli.us Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan Subject: [PATCH net-next 1/6] net: kcm: Simplify the allocation of slab caches Date: Mon, 5 Feb 2024 15:20:08 +0800 Message-Id: <20240205072013.427639-2-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240205072013.427639-1-chentao@kylinos.cn> References: <20240205072013.427639-1-chentao@kylinos.cn> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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 --- 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 = -ENOMEM; - kcm_muxp = kmem_cache_create("kcm_mux_cache", - sizeof(struct kcm_mux), 0, - SLAB_HWCACHE_ALIGN, NULL); + kcm_muxp = KMEM_CACHE(kcm_mux, SLAB_HWCACHE_ALIGN); if (!kcm_muxp) goto fail; - kcm_psockp = kmem_cache_create("kcm_psock_cache", - sizeof(struct kcm_psock), 0, - SLAB_HWCACHE_ALIGN, NULL); + kcm_psockp = KMEM_CACHE(kcm_psock, SLAB_HWCACHE_ALIGN); if (!kcm_psockp) goto fail; From patchwork Mon Feb 5 07:20:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunwu Chan X-Patchwork-Id: 13545032 X-Patchwork-Delegate: kuba@kernel.org 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 4C37C12E73; Mon, 5 Feb 2024 07:20:44 +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=1707117647; cv=none; b=EDCBBHih3hMk9ARznODPjIba1+MHKuuDv6bxGmLc9MhtoNykZw5DzWsMEsLW9cAxXkbFAQfbfgyUlGTi9T22vR23IfhBeAT9YuXZhRckHfOByuApLlxMtMxoiGJPfhFV6T8bJ9UtK/5LCi87TWf8KJWpsBhj3m7VG8JR/2NrW2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707117647; c=relaxed/simple; bh=k6Zn+/rUFV8ZYijFcqy7Xv2FOiKYO2DWsKSu3lTTGh4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BHrw/lyxjTxpbE2oifZgJeUVvNI/8/3HViMazPj1wEndXz7klEopnNFBiHSxU+wav+fu0ZOzC7vUIVrG+ufWFZJ0V1Qx1Bk45Y//yWYQuPMABksU8N3GY3beTE77TGiwAE9OcPTwAEc8xtNftVbNJGAU+gnLZx965zDtCub4kIo= 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: 11b7df22684942e3a304abe1199f6ce1-20240205 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:c67de021-7fef-4294-98f9-f2e0ec74004c,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:c67de021-7fef-4294-98f9-f2e0ec74004c,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:76d12080-4f93-4875-95e7-8c66ea833d57,B ulkID:240205152042EC5T5IF3,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: 11b7df22684942e3a304abe1199f6ce1-20240205 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1182238079; Mon, 05 Feb 2024 15:20:40 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 1411BE000EBC; Mon, 5 Feb 2024 15:20:40 +0800 (CST) X-ns-mid: postfix-65C08C47-86855474 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id 5E90BE000EBC; Mon, 5 Feb 2024 15:20:39 +0800 (CST) From: Kunwu Chan To: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jiri@resnulli.us Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan Subject: [PATCH net-next 2/6] ip6mr: Simplify the allocation of slab caches in ip6_mr_init Date: Mon, 5 Feb 2024 15:20:09 +0800 Message-Id: <20240205072013.427639-3-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240205072013.427639-1-chentao@kylinos.cn> References: <20240205072013.427639-1-chentao@kylinos.cn> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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 --- 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; - mrt_cachep = kmem_cache_create("ip6_mrt_cache", - sizeof(struct mfc6_cache), - 0, SLAB_HWCACHE_ALIGN, - NULL); + mrt_cachep = KMEM_CACHE(mfc6_cache, SLAB_HWCACHE_ALIGN); if (!mrt_cachep) return -ENOMEM; From patchwork Mon Feb 5 07:20:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunwu Chan X-Patchwork-Id: 13545033 X-Patchwork-Delegate: kuba@kernel.org 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 29CFE10A25; Mon, 5 Feb 2024 07:20:45 +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=1707117648; cv=none; b=T0vRCpp7XotnTsEzrzIc65MLupnQNw9UQ/FwARcw4H3DMVOF+uVtvoYCMpNoj531Z34ZN+UEaWvkPr8ULNjHHWqHHipzOukxyqc3dZ63OXHTGAkIcODspI+pvd2ebcoPUuVsbn14xyjdNGjClyXK0M1q7tTgHCjyXuOi95ypj60= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707117648; c=relaxed/simple; bh=biOCybBNDhjOReD9xZnf1JAj6jSi0ruvZfoR2nzth48=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XRCHNzd3k2Js60C4wMFybSS9bDtNDTDB9JIEW6mzTWgbyLNut22DCrCQNeI7tPmrJXliumjXRXGvACrxaOptgBmMDhlckC83+wjPzL4ZUDzYu8dwfIknOkZNVOiHDgAZU0+z1K87tkH9doUWm5O/Y0joxkE8WQRvhr+THFF+pDI= 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: fddf02a90dd44ab288f898ab8ea2abeb-20240205 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:50d1ff59-2439-4ffe-8ed1-576131a8fe74,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:50d1ff59-2439-4ffe-8ed1-576131a8fe74,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:23af078f-e2c0-40b0-a8fe-7c7e47299109,B ulkID:240205152044NCROXGAD,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: fddf02a90dd44ab288f898ab8ea2abeb-20240205 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 2072795595; Mon, 05 Feb 2024 15:20:42 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 597F8E000EBD; Mon, 5 Feb 2024 15:20:42 +0800 (CST) X-ns-mid: postfix-65C08C4A-16642375 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id A0048E000EBC; Mon, 5 Feb 2024 15:20:41 +0800 (CST) From: Kunwu Chan To: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jiri@resnulli.us Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan Subject: [PATCH net-next 3/6] ipmr: Simplify the allocation of slab caches Date: Mon, 5 Feb 2024 15:20:10 +0800 Message-Id: <20240205072013.427639-4-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240205072013.427639-1-chentao@kylinos.cn> References: <20240205072013.427639-1-chentao@kylinos.cn> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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 --- 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; - mrt_cachep = kmem_cache_create("ip_mrt_cache", - sizeof(struct mfc_cache), - 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, - NULL); + mrt_cachep = KMEM_CACHE(mfc_cache, SLAB_HWCACHE_ALIGN | SLAB_PANIC); err = register_pernet_subsys(&ipmr_net_ops); if (err) From patchwork Mon Feb 5 07:20:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunwu Chan X-Patchwork-Id: 13545034 X-Patchwork-Delegate: kuba@kernel.org 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 B359414003; Mon, 5 Feb 2024 07:20:54 +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=1707117657; cv=none; b=ETnwbRABu0hRB10RJj+LzrLC1y3ZDRsVdBj+/o5qpwWu5VAuZ6zSPQuVwSR+j2zkVNIwv123gw4jhBuwpKZIbqPA152JthBuqngf4LqdvPjHBoYW+ShK4MkdQQWz1LXpGdhNAVdNaMJ5qaj8w4h8J5mdWwt7WKWI7ups6iu4NJg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707117657; c=relaxed/simple; bh=RHE0LMIn4zyWVNGXbkE7p6boihvrVpYXBiDhFq/TJGE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=itkB4JgM2nmdeuuMxiHB2IplWrqysuOuQ+/FPGxtGsYoRyawEQGXHZK74F/kOdmQKkwANwVPhphH2V+NMJUOi8GYmZNBsySzPzZriLdvNF+XYdhKlL4AZn/MCJsomRYcVYNuc/pvaS2fYTflHBDsTVfCzqsAJ4ZXrFJZLoPSxFc= 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: 48ae3ccd55694fbabe74fcc28e97ff4f-20240205 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:2c1467bf-ae10-4938-a48f-4bd262aa0b81,IP:10, URL:0,TC:0,Content:-5,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACT ION:release,TS:-10 X-CID-INFO: VERSION:1.1.35,REQID:2c1467bf-ae10-4938-a48f-4bd262aa0b81,IP:10,UR L:0,TC:0,Content:-5,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-10 X-CID-META: VersionHash:5d391d7,CLOUDID:aeb1a083-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:240205152050HVK6NM51,BulkQuantity:0,Recheck:0,SF:66|38|24|17|19|44|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: 48ae3ccd55694fbabe74fcc28e97ff4f-20240205 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1240959891; Mon, 05 Feb 2024 15:20:49 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id ADDA3E000EBC; Mon, 5 Feb 2024 15:20:49 +0800 (CST) X-ns-mid: postfix-65C08C51-51464976 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id 0134EE000EBC; Mon, 5 Feb 2024 15:20:48 +0800 (CST) From: Kunwu Chan To: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jiri@resnulli.us Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan Subject: [PATCH net-next 4/6] ipv4: Simplify the allocation of slab caches in ip_rt_init Date: Mon, 5 Feb 2024 15:20:11 +0800 Message-Id: <20240205072013.427639-5-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240205072013.427639-1-chentao@kylinos.cn> References: <20240205072013.427639-1-chentao@kylinos.cn> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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 --- 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 - ipv4_dst_ops.kmem_cachep = - kmem_cache_create("ip_dst_cache", sizeof(struct rtable), 0, - SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); + ipv4_dst_ops.kmem_cachep = KMEM_CACHE(rtable, + SLAB_HWCACHE_ALIGN | SLAB_PANIC); ipv4_dst_blackhole_ops.kmem_cachep = ipv4_dst_ops.kmem_cachep; From patchwork Mon Feb 5 07:20:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunwu Chan X-Patchwork-Id: 13545035 X-Patchwork-Delegate: kuba@kernel.org 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 84E1614008; Mon, 5 Feb 2024 07:20:57 +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=1707117659; cv=none; b=p2QfR7buEhT5sfmCzfQWeVg4passK9zsJVQPkI+GwkT/I23m8Y0vMrwkKOrZsjPF3U3y48TrxgtUhgifuoV0NeR5cuX9LmAWvhzxb5ZCDOFs5N2hrRVBqsQTalVnNKsqOvPXxsr530rGfjSHrlo9GqKQ5Zb4AwLjCkNRITLZors= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707117659; c=relaxed/simple; bh=EWhvGxiu9nKUlD223b5RUmg8URskoZ2Ajs6i2J1FTec=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LHE9Liic0D/v0t0Z5wdOOdh+WyDSxxz6YWOiqOCd3Qh72QmnfdJGyqtbKhmzMBABZeGTbcMkz8LmhkN3SfdSS5KMtqtJdiLuM7Qtn43qTJGbXsOh9IaSr2dGnngiW3WvLPZhAbuE1DiNUfViooZKrAovczKeT7luaFhJSqQQLL8= 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: e1b809629f7a4cb6adc5306ec28bb32f-20240205 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:834f65fe-04d1-422d-887d-cfff6283464b,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:834f65fe-04d1-422d-887d-cfff6283464b,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:97af078f-e2c0-40b0-a8fe-7c7e47299109,B ulkID:240205152053NOLOL8W3,BulkQuantity:0,Recheck:0,SF:19|44|66|38|24|17|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_FSD,TF_CID_SPAM_FSI,TF_CID_SPAM_SNR,TF_CID_SPAM_FAS X-UUID: e1b809629f7a4cb6adc5306ec28bb32f-20240205 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1384232374; Mon, 05 Feb 2024 15:20:52 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 4B1EEE000EBC; Mon, 5 Feb 2024 15:20:52 +0800 (CST) X-ns-mid: postfix-65C08C54-11146078 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id 93223E000EBC; Mon, 5 Feb 2024 15:20:51 +0800 (CST) From: Kunwu Chan To: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jiri@resnulli.us Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan Subject: [PATCH net-next 5/6] tcp: Simplify the allocation of slab caches Date: Mon, 5 Feb 2024 15:20:12 +0800 Message-Id: <20240205072013.427639-6-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240205072013.427639-1-chentao@kylinos.cn> References: <20240205072013.427639-1-chentao@kylinos.cn> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Use the new KMEM_CACHE() macro instead of direct kmem_cache_create to simplify the creation of SLAB caches. And change cache name from 'tcp_bind_bucket' to 'inet_bind_bucket', 'tcp_bind2_bucket' to 'inet_bind2_bucket'. Signed-off-by: Kunwu Chan --- net/ipv4/tcp.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index a1c6de385cce..2dc3dd4323c2 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -4697,17 +4697,11 @@ void __init tcp_init(void) thash_entries, 21, /* one slot per 2 MB*/ 0, 64 * 1024); tcp_hashinfo.bind_bucket_cachep = - kmem_cache_create("tcp_bind_bucket", - sizeof(struct inet_bind_bucket), 0, - SLAB_HWCACHE_ALIGN | SLAB_PANIC | - SLAB_ACCOUNT, - NULL); + KMEM_CACHE(inet_bind_bucket, + SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT); tcp_hashinfo.bind2_bucket_cachep = - kmem_cache_create("tcp_bind2_bucket", - sizeof(struct inet_bind2_bucket), 0, - SLAB_HWCACHE_ALIGN | SLAB_PANIC | - SLAB_ACCOUNT, - NULL); + KMEM_CACHE(inet_bind2_bucket, + SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT); /* Size and allocate the main established and bind bucket * hash tables. From patchwork Mon Feb 5 07:20:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunwu Chan X-Patchwork-Id: 13545036 X-Patchwork-Delegate: kuba@kernel.org 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 3FEE6111A2; Mon, 5 Feb 2024 07:20:57 +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=1707117660; cv=none; b=QrVjTvFT31LurIGu3jsTRfrC7Ge2duwrXRGwkau/SbhW7HlAHx+73pXnHiXCqyOfWz3N8nlFr44H+HSB1jpMOuN5d0K2FAwuxzh/2uLIzUvwj9KbcMwHxjVpsAXL4vHjMZQqJtzq6F4ENhxbdKGj8JkrztRAlueA2EaMhe5c6uA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707117660; c=relaxed/simple; bh=2RPhHIO24rO7DrKNGK166qDpBMo7ED6D9CiaT+aa0kg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=slDNABwoIz4GBxsgzQfZGbg16AW1HvW8dRHKQgf2Mee4xJlsqdjUT2f9yVSEBv1GA9t2xAiFi8ncT7+b9aAoXHI+SlvKfnqh5fFzeZA9CYqqzHFMoAaj8YRxEL6H4LhEboOUzOPzC7KfH9uNm403Lg4M+XTjxR9qdNwZxxzgdqA= 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: 3c01047df7ec4e4c9cf90160e14ee212-20240205 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:2fe792de-25ed-4861-8503-5727ad80d150,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:2fe792de-25ed-4861-8503-5727ad80d150,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:cbb1a083-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:240205152054PAMNL1WR,BulkQuantity:0,Recheck:0,SF:66|38|24|17|19|44|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: 3c01047df7ec4e4c9cf90160e14ee212-20240205 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 2062955715; Mon, 05 Feb 2024 15:20:53 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 123C0E000EBC; Mon, 5 Feb 2024 15:20:53 +0800 (CST) X-ns-mid: postfix-65C08C54-87813279 Received: from kernel.. (unknown [172.20.15.254]) by mail.kylinos.cn (NSMail) with ESMTPA id 5B4D9E000EBD; Mon, 5 Feb 2024 15:20:52 +0800 (CST) From: Kunwu Chan To: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jiri@resnulli.us Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan Subject: [PATCH net-next 6/6] ipv6: Simplify the allocation of slab caches Date: Mon, 5 Feb 2024 15:20:13 +0800 Message-Id: <20240205072013.427639-7-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240205072013.427639-1-chentao@kylinos.cn> References: <20240205072013.427639-1-chentao@kylinos.cn> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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/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 = -ENOMEM; - fib6_node_kmem = kmem_cache_create("fib6_nodes", - sizeof(struct fib6_node), 0, - SLAB_HWCACHE_ALIGN | SLAB_ACCOUNT, - NULL); + fib6_node_kmem = KMEM_CACHE(fib6_node, + SLAB_HWCACHE_ALIGN | SLAB_ACCOUNT); if (!fib6_node_kmem) goto out;