Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2245103rdb; Sun, 4 Feb 2024 23:31:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IH5A+ASqevh/FhZoxHrHpiHh99G1hqxSj/UBbQ9ATchLHgD5yLpGnzOHkVcCYCBhhby3GST X-Received: by 2002:a17:902:f545:b0:1d9:a66a:1c26 with SMTP id h5-20020a170902f54500b001d9a66a1c26mr3616282plf.20.1707118317840; Sun, 04 Feb 2024 23:31:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707118317; cv=pass; d=google.com; s=arc-20160816; b=ewjbQRtCL/JWpW4LDB3E2U26tq0ybDuFPe7OFO+EvfjdHtF+Y4tri4MTc7gbNKNsF+ dgEDizkGmCN0G/h0NMlGEdQbrpGJ3zdxF0TRoc8NjUvVmQC/MfU6oCpZCnhivin2whzQ kyR2u6KO5QlkJ1Jj9+4AP5g6U9kIRzkJnYUoR7zRfHT51JyBaEjjJS9zL5wn+9k0kqpe pRM49S7oQICZn1jXcvRte9uX1zuiNUZn7KMFjHkzUTywDLl9T/mtPsYdIJgboHluewMP VLCpnMBTlmB+NDour5Jp+NuLO/eZp/d0zLW0H36Bw4FFrzelePD56efmX8C8Frx0mOjc H9zA== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=xnlFG+nfhFlFijs9gGKkG6m3l0HnLeicdLGqBC+a4dU=; fh=QhqN7JWZYzBMBvuPv3DkUUX4quN/6slVc/k/jGGrq40=; b=UI1OAM/jPr+7NFqKco/AxWXb3H4Mk0RJq3xucQKQEbsVYPzgQba2f94EJiTFL3Yeov IE/FMzVCTkRF1Yhx7H32fp+P2KQDkVwIGQH4WC/sgbgk2471eOeMrpBV7PkDOgyRaErG FBAcyDlbVESzbOHkXj+4YQjGVLH41PfNimOJ9FdL4GvKj3cT/5OvdLCk+eC11JSvE4Ok cMG2eEOA5ZNU32kaluWPufGIu6YGeIVARVVMVZOLNkSvLhfCwfFomR+s7PhWtYdSlYTy V7a/QksuYIkujZolmNi9udSdsjCb8+Hovsc6ZmOykdgLF3MDUd7g35NX44gRTvNPGsij szjQ==; dara=google.com 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-52130-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52130-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWbfvMqXmo8WV10ixMiac2dHw8lEs+nzkugruf37MjP228v5GDCtDr+FF0DWXbZ2qaVt67IguBqrCARXSJS3L1kiJ60O75UVPXGoUrwQg== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u3-20020a17090341c300b001d90376dd49si6069516ple.526.2024.02.04.23.31.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 23:31:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52130-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-52130-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52130-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id F3771B246E0 for ; Mon, 5 Feb 2024 07:23:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 065C414294; Mon, 5 Feb 2024 07:21:00 +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 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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 =3D - 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 =3D - 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); =20 /* Size and allocate the main established and bind bucket * hash tables. --=20 2.39.2