Message ID | 20240117072045.142215-1-chentao@kylinos.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-28593-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp744377dye; Tue, 16 Jan 2024 23:22:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHFNcW+7L1GnV6KT1H1sFKcXOn39/sh3pDKcvaKUEtJo0wLq3hn7vTny32DVsRBCvJ3iq+z X-Received: by 2002:a05:6a20:d428:b0:199:82b7:dd9c with SMTP id il40-20020a056a20d42800b0019982b7dd9cmr3313122pzb.110.1705476121102; Tue, 16 Jan 2024 23:22:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705476121; cv=pass; d=google.com; s=arc-20160816; b=AyMaTrgkgvP5sGCG+OB6swpQcbJH7ZRVm1T2nOMkb2+pHgaU7Z/Zv6MQBc/L6u+05i yPvvWeQvw+UZH651LV2HLKakGsIcvyrbsshBStaukjWG25+yAp1JYnjszmbV+pYELu4P U5caDtLd+FC8RSByriZ+n13/xsY6Zf3S3ni/WMhPwV7zDpb3SZ+aPbfe3t+UOI/LmFE7 5EfbTwIlJYlwAuP1VS8n9nD1kerBp7CPjFpvkRG1N6YSiMgFF2fzaogckBXiBROCmdyx CxI1vSL4/ADGIS9+cdHhZjiGU8QrU+jC40j1j2AVP+hIN04JCB2LvIHd7jZnGeuMqjQF jq/A== 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=Lk9gefFxmDdvaS//HRYjH5qHD0gnSgfVQUbXrjq97hg=; fh=VdnP4ZMDE8aIB4cNGJOYlcFHLNb0FRctcuJvPfAqr9I=; b=w+zZHmcfyaGR1taK/Y3Mk7LZU4W4vsqz7aBD6jVLCF6TreDcNi8XJoLd4VH0D/kPfO MmESzLT0ShLGbisnT6cKFnboLtDF54WlUZaaDLgdqvlf+6cWNchGBC3hiqvAlQIMfQ5v W8Qb4RUCIFZnv4pnL+g24kAHlBQbk0ECdeAVdAG7P+A246W6tgjj2SITaidWvzfQ1jfl WZvEuux7abPkhS5rpBVHvtSTNV6aJxr0Hi3oKHhoxXhkJZ1+qUGtPNAe6z/KAQao+uq1 aQupbdPtam8Jdlzfkl7922opE6NC/Ie3wYtXbzJ6MnnKyzCSbUvUxPXC5IKFmvLC53eM VQig== 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-28593-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28593-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h1-20020a170902f7c100b001d6ecdadeeasi1196287plw.315.2024.01.16.23.22.00 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 23:22:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28593-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-28593-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28593-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 857B5287B2C for <ouuuleilei@gmail.com>; Wed, 17 Jan 2024 07:22:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 15E2AC139; Wed, 17 Jan 2024 07:21:43 +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 9FB2D8F65; Wed, 17 Jan 2024 07:21:36 +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=1705476101; cv=none; b=UGpwCkpseiDOI036cgDUWJ2I6O23BB6K6oFCn5iEuoJQeAjmvHmj5SyHXlATxbRykX6s+NlEaS5+uYFb1UJ0KZ05Pp4ANjlhhmVe+lHsrF72IQ8gHg9BnG8bkYN6+fMdV9uoMSQF619y5Xb8jQviZo2Ao+Nx0bkp8IPcjhI3Gsg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705476101; c=relaxed/simple; bh=O85UiwYAkF07o9wiQzUPQRXlOapOHteQzq9bjUp60XQ=; h=X-UUID:X-CID-P-RULE:X-CID-O-INFO:X-CID-INFO:X-CID-META:X-CID-BVR: X-CID-BAS:X-CID-FACTOR:X-UUID:Received:Received:X-ns-mid:Received: From:To:Cc:Subject:Date:Message-Id:X-Mailer:MIME-Version: Content-Transfer-Encoding; b=Rwf0tNtcY5iDKf12P6e0fJnZJCHfxqLn4BhU3Eqol39LINr9iJDIpi9XWjSQAbhc53h3nTDMyrMI1NYqQrZmEFSLcHxVpWhKb4/oh6fHYzCgitbNLpemkTwlz45RtCbIlgdM6BleWhq4MHO5VgsJA1bQowPgDGBi6MbpPdULH1E= 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: 2a46221058924310b9c594314f2c70d8-20240117 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:e7c0f8e5-df89-401e-9dd4-769b4832632e,IP:10, URL:0,TC:0,Content:0,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACT ION:release,TS:20 X-CID-INFO: VERSION:1.1.35,REQID:e7c0f8e5-df89-401e-9dd4-769b4832632e,IP:10,UR L:0,TC:0,Content:0,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:20 X-CID-META: VersionHash:5d391d7,CLOUDID:9f08422f-1ab8-4133-9780-81938111c800,B ulkID:240117152134M9ZOJKSL,BulkQuantity:0,Recheck:0,SF:38|24|17|19|44|66|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_FSD,TF_CID_SPAM_FSI,TF_CID_SPAM_SNR,TF_CID_SPAM_FAS X-UUID: 2a46221058924310b9c594314f2c70d8-20240117 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from <chentao@kylinos.cn>) (Generic MTA) with ESMTP id 697907986; Wed, 17 Jan 2024 15:21:33 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 7AFCAE000EB9; Wed, 17 Jan 2024 15:21:33 +0800 (CST) X-ns-mid: postfix-65A77FFD-295721259 Received: from kernel.. (unknown [172.20.15.234]) by mail.kylinos.cn (NSMail) with ESMTPA id B043EE000EB9; Wed, 17 Jan 2024 15:21:28 +0800 (CST) From: Kunwu Chan <chentao@kylinos.cn> To: horms@verge.net.au, ja@ssi.bg, pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kernel@vger.kernel.org, Kunwu Chan <chentao@kylinos.cn> Subject: [PATCH net] ipvs: Simplify the allocation of ip_vs_conn slab caches Date: Wed, 17 Jan 2024 15:20:45 +0800 Message-Id: <20240117072045.142215-1-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788321329343272538 X-GMAIL-MSGID: 1788321329343272538 |
Series |
[net] ipvs: Simplify the allocation of ip_vs_conn slab caches
|
|
Commit Message
Kunwu Chan
Jan. 17, 2024, 7:20 a.m. UTC
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
net/netfilter/ipvs/ip_vs_conn.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
Comments
On 1/17/24 10:20, Kunwu Chan wrote: > Use the new KMEM_CACHE() macro instead of direct kmem_cache_create > to simplify the creation of SLAB caches. > > Signed-off-by: Kunwu Chan <chentao@kylinos.cn> The patch is actually for net-next > --- > net/netfilter/ipvs/ip_vs_conn.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c > index a743db073887..98d7dbe3d787 100644 > --- a/net/netfilter/ipvs/ip_vs_conn.c > +++ b/net/netfilter/ipvs/ip_vs_conn.c > @@ -1511,9 +1511,7 @@ int __init ip_vs_conn_init(void) > return -ENOMEM; > > /* Allocate ip_vs_conn slab cache */ > - ip_vs_conn_cachep = kmem_cache_create("ip_vs_conn", > - sizeof(struct ip_vs_conn), 0, > - SLAB_HWCACHE_ALIGN, NULL); > + ip_vs_conn_cachep = KMEM_CACHE(ip_vs_conn, SLAB_HWCACHE_ALIGN); > if (!ip_vs_conn_cachep) { > kvfree(ip_vs_conn_tab); > return -ENOMEM;
On Wed, Jan 17, 2024 at 03:20:45PM +0800, Kunwu Chan wrote: > Use the new KMEM_CACHE() macro instead of direct kmem_cache_create > to simplify the creation of SLAB caches. > > Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Hi Kunwu Chan, I think this is more of a cleanup than a fix, so it should probably be targeted at 'nf-next' rather than 'net'. If it is a fix, then I would suggest targeting it at 'nf' and providing a Fixes tag. The above notwithstanding, this looks good to me. Acked-by: Simon Horman <horms@kernel.org> > --- > net/netfilter/ipvs/ip_vs_conn.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c > index a743db073887..98d7dbe3d787 100644 > --- a/net/netfilter/ipvs/ip_vs_conn.c > +++ b/net/netfilter/ipvs/ip_vs_conn.c > @@ -1511,9 +1511,7 @@ int __init ip_vs_conn_init(void) > return -ENOMEM; > > /* Allocate ip_vs_conn slab cache */ > - ip_vs_conn_cachep = kmem_cache_create("ip_vs_conn", > - sizeof(struct ip_vs_conn), 0, > - SLAB_HWCACHE_ALIGN, NULL); > + ip_vs_conn_cachep = KMEM_CACHE(ip_vs_conn, SLAB_HWCACHE_ALIGN); > if (!ip_vs_conn_cachep) { > kvfree(ip_vs_conn_tab); > return -ENOMEM;
Hi Simon, Thanks for your reply. On 2024/1/17 17:29, Simon Horman wrote: > On Wed, Jan 17, 2024 at 03:20:45PM +0800, Kunwu Chan wrote: >> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create >> to simplify the creation of SLAB caches. >> >> Signed-off-by: Kunwu Chan <chentao@kylinos.cn> > > Hi Kunwu Chan, > > I think this is more of a cleanup than a fix, > so it should probably be targeted at 'nf-next' rather than 'net'. Thanks, I'm confused about when to use "nf-next" or "net" or "net-next". "nf-next" means fixing errors for linux-next.git and linux-stable.git, while "nf" or "next" just means linux-next.git? > > If it is a fix, then I would suggest targeting it at 'nf' > and providing a Fixes tag. I'll keep it in mind in the future. > > The above notwithstanding, this looks good to me. > > Acked-by: Simon Horman <horms@kernel.org> > >> --- >> net/netfilter/ipvs/ip_vs_conn.c | 4 +--- >> 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c >> index a743db073887..98d7dbe3d787 100644 >> --- a/net/netfilter/ipvs/ip_vs_conn.c >> +++ b/net/netfilter/ipvs/ip_vs_conn.c >> @@ -1511,9 +1511,7 @@ int __init ip_vs_conn_init(void) >> return -ENOMEM; >> >> /* Allocate ip_vs_conn slab cache */ >> - ip_vs_conn_cachep = kmem_cache_create("ip_vs_conn", >> - sizeof(struct ip_vs_conn), 0, >> - SLAB_HWCACHE_ALIGN, NULL); >> + ip_vs_conn_cachep = KMEM_CACHE(ip_vs_conn, SLAB_HWCACHE_ALIGN); >> if (!ip_vs_conn_cachep) { >> kvfree(ip_vs_conn_tab); >> return -ENOMEM;
On Thu, Jan 18, 2024 at 10:22:05AM +0800, Kunwu Chan wrote: > Hi Simon, > > Thanks for your reply. > > On 2024/1/17 17:29, Simon Horman wrote: > > On Wed, Jan 17, 2024 at 03:20:45PM +0800, Kunwu Chan wrote: > > > Use the new KMEM_CACHE() macro instead of direct kmem_cache_create > > > to simplify the creation of SLAB caches. > > > > > > Signed-off-by: Kunwu Chan <chentao@kylinos.cn> > > > > Hi Kunwu Chan, > > > > I think this is more of a cleanup than a fix, > > so it should probably be targeted at 'nf-next' rather than 'net'. > Thanks, I'm confused about when to use "nf-next" or "net" or "net-next". > "nf-next" means fixing errors for linux-next.git and linux-stable.git, while > "nf" or "next" just means linux-next.git? Hi Kunwu, nf is for fixes for Netfilter (which includes IPVS). The target tree is nf.git nf-next is for non-fixes for Netfilter. The target tree if nf-next.git net is for fixes for Networking code, which does not have a more specific tree (as is the case for Netfilter). The target tree is net.git. Liikewise, net-next is for non-fixes for Networking code. The target tree is net-next.git The MAINTAINERS file, and get_maintainers.pl script are useful here. nf is merged into net on request from the Netfilter maintainers, this is it's path to released kernels. Likewise, nf-next is merged into net-next. > > > > > If it is a fix, then I would suggest targeting it at 'nf' > > and providing a Fixes tag. > I'll keep it in mind in the future. > > > > The above notwithstanding, this looks good to me. > > > > Acked-by: Simon Horman <horms@kernel.org> > > > > > --- > > > net/netfilter/ipvs/ip_vs_conn.c | 4 +--- > > > 1 file changed, 1 insertion(+), 3 deletions(-) > > > > > > diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c > > > index a743db073887..98d7dbe3d787 100644 > > > --- a/net/netfilter/ipvs/ip_vs_conn.c > > > +++ b/net/netfilter/ipvs/ip_vs_conn.c > > > @@ -1511,9 +1511,7 @@ int __init ip_vs_conn_init(void) > > > return -ENOMEM; > > > /* Allocate ip_vs_conn slab cache */ > > > - ip_vs_conn_cachep = kmem_cache_create("ip_vs_conn", > > > - sizeof(struct ip_vs_conn), 0, > > > - SLAB_HWCACHE_ALIGN, NULL); > > > + ip_vs_conn_cachep = KMEM_CACHE(ip_vs_conn, SLAB_HWCACHE_ALIGN); > > > if (!ip_vs_conn_cachep) { > > > kvfree(ip_vs_conn_tab); > > > return -ENOMEM; > -- > Thanks, > Kunwu >
On 2024/1/19 23:20, Simon Horman wrote: > On Thu, Jan 18, 2024 at 10:22:05AM +0800, Kunwu Chan wrote: >> Hi Simon, >> >> Thanks for your reply. >> >> On 2024/1/17 17:29, Simon Horman wrote: >>> On Wed, Jan 17, 2024 at 03:20:45PM +0800, Kunwu Chan wrote: >>>> Use the new KMEM_CACHE() macro instead of direct kmem_cache_create >>>> to simplify the creation of SLAB caches. >>>> >>>> Signed-off-by: Kunwu Chan <chentao@kylinos.cn> >>> >>> Hi Kunwu Chan, >>> >>> I think this is more of a cleanup than a fix, >>> so it should probably be targeted at 'nf-next' rather than 'net'. >> Thanks, I'm confused about when to use "nf-next" or "net" or "net-next". >> "nf-next" means fixing errors for linux-next.git and linux-stable.git, while >> "nf" or "next" just means linux-next.git? > > Hi Kunwu, > > nf is for fixes for Netfilter (which includes IPVS). The target tree is nf.git > nf-next is for non-fixes for Netfilter. The target tree if nf-next.git > > net is for fixes for Networking code, which does not have a more specific > tree (as is the case for Netfilter). The target tree is net.git. > Liikewise, net-next is for non-fixes for Networking code. > The target tree is net-next.git > Hi Simon, Thank you very much for your detailed guidance. In the future, I will carefully follow the rules you introduced to set the appropriate subject for the patch. > The MAINTAINERS file, and get_maintainers.pl script are useful here. > > nf is merged into net on request from the Netfilter maintainers, > this is it's path to released kernels. > Likewise, nf-next is merged into net-next. > Before send the patch, I'll read the MAINTAINERS file, and search in email-list to confirm the correct subject. And if need a new subject patch, i could resend a new one. >> >>> >>> If it is a fix, then I would suggest targeting it at 'nf' >>> and providing a Fixes tag. >> I'll keep it in mind in the future. >>> >>> The above notwithstanding, this looks good to me. >>> >>> Acked-by: Simon Horman <horms@kernel.org> >>> >>>> --- >>>> net/netfilter/ipvs/ip_vs_conn.c | 4 +--- >>>> 1 file changed, 1 insertion(+), 3 deletions(-) >>>> >>>> diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c >>>> index a743db073887..98d7dbe3d787 100644 >>>> --- a/net/netfilter/ipvs/ip_vs_conn.c >>>> +++ b/net/netfilter/ipvs/ip_vs_conn.c >>>> @@ -1511,9 +1511,7 @@ int __init ip_vs_conn_init(void) >>>> return -ENOMEM; >>>> /* Allocate ip_vs_conn slab cache */ >>>> - ip_vs_conn_cachep = kmem_cache_create("ip_vs_conn", >>>> - sizeof(struct ip_vs_conn), 0, >>>> - SLAB_HWCACHE_ALIGN, NULL); >>>> + ip_vs_conn_cachep = KMEM_CACHE(ip_vs_conn, SLAB_HWCACHE_ALIGN); >>>> if (!ip_vs_conn_cachep) { >>>> kvfree(ip_vs_conn_tab); >>>> return -ENOMEM; >> -- >> Thanks, >> Kunwu >>
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c index a743db073887..98d7dbe3d787 100644 --- a/net/netfilter/ipvs/ip_vs_conn.c +++ b/net/netfilter/ipvs/ip_vs_conn.c @@ -1511,9 +1511,7 @@ int __init ip_vs_conn_init(void) return -ENOMEM; /* Allocate ip_vs_conn slab cache */ - ip_vs_conn_cachep = kmem_cache_create("ip_vs_conn", - sizeof(struct ip_vs_conn), 0, - SLAB_HWCACHE_ALIGN, NULL); + ip_vs_conn_cachep = KMEM_CACHE(ip_vs_conn, SLAB_HWCACHE_ALIGN); if (!ip_vs_conn_cachep) { kvfree(ip_vs_conn_tab); return -ENOMEM;