diff mbox series

[net] ipvs: Simplify the allocation of ip_vs_conn slab caches

Message ID 20240117072045.142215-1-chentao@kylinos.cn (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [net] ipvs: Simplify the allocation of ip_vs_conn slab caches | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success SINGLE THREAD; Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1080 this patch: 1080
netdev/cc_maintainers success CCed 0 of 0 maintainers
netdev/build_clang success Errors and warnings before: 1095 this patch: 1095
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1095 this patch: 1095
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest pending net-next-2024-01-17--09-00

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

Denis Kirjanov Jan. 17, 2024, 9:16 a.m. UTC | #1
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;
Simon Horman Jan. 17, 2024, 9:29 a.m. UTC | #2
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;
Kunwu Chan Jan. 18, 2024, 2:22 a.m. UTC | #3
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;
Simon Horman Jan. 19, 2024, 3:20 p.m. UTC | #4
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
>
Kunwu Chan Jan. 22, 2024, 7:35 a.m. UTC | #5
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 mbox series

Patch

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;