Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net-kmem-cache-create'

Kunwu Chan says:

====================
net: Use KMEM_CACHE instead of kmem_cache_create

As Jiri Pirko suggests,
I'm using a patchset to cleanup the same issues in the 'net' module.
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.

Some cache names are changed to be the same as struct names.
This change is recorded in the changelog for easy reference.
It's harmless cause it's used in /proc/slabinfo to identify this cache.
---
Changes in v2:
- Delete a patch as Eric said in https://lore.kernel.org/all/CANn89iLkWvum6wSqSya_K+1eqnFvp=L2WLW=kAYrZTF8Ei4b7g@mail.gmail.com/
- No code changes,only add Reviewed-by tag
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+8 -21
+1 -4
net/ipv4/ipmr.c
··· 3139 3139 { 3140 3140 int err; 3141 3141 3142 - mrt_cachep = kmem_cache_create("ip_mrt_cache", 3143 - sizeof(struct mfc_cache), 3144 - 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, 3145 - NULL); 3142 + mrt_cachep = KMEM_CACHE(mfc_cache, SLAB_HWCACHE_ALIGN | SLAB_PANIC); 3146 3143 3147 3144 err = register_pernet_subsys(&ipmr_net_ops); 3148 3145 if (err)
+2 -3
net/ipv4/route.c
··· 3693 3693 panic("IP: failed to allocate ip_rt_acct\n"); 3694 3694 #endif 3695 3695 3696 - ipv4_dst_ops.kmem_cachep = 3697 - kmem_cache_create("ip_dst_cache", sizeof(struct rtable), 0, 3698 - SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); 3696 + ipv4_dst_ops.kmem_cachep = KMEM_CACHE(rtable, 3697 + SLAB_HWCACHE_ALIGN | SLAB_PANIC); 3699 3698 3700 3699 ipv4_dst_blackhole_ops.kmem_cachep = ipv4_dst_ops.kmem_cachep; 3701 3700
+2 -4
net/ipv6/ip6_fib.c
··· 2493 2493 { 2494 2494 int ret = -ENOMEM; 2495 2495 2496 - fib6_node_kmem = kmem_cache_create("fib6_nodes", 2497 - sizeof(struct fib6_node), 0, 2498 - SLAB_HWCACHE_ALIGN | SLAB_ACCOUNT, 2499 - NULL); 2496 + fib6_node_kmem = KMEM_CACHE(fib6_node, 2497 + SLAB_HWCACHE_ALIGN | SLAB_ACCOUNT); 2500 2498 if (!fib6_node_kmem) 2501 2499 goto out; 2502 2500
+1 -4
net/ipv6/ip6mr.c
··· 1373 1373 { 1374 1374 int err; 1375 1375 1376 - mrt_cachep = kmem_cache_create("ip6_mrt_cache", 1377 - sizeof(struct mfc6_cache), 1378 - 0, SLAB_HWCACHE_ALIGN, 1379 - NULL); 1376 + mrt_cachep = KMEM_CACHE(mfc6_cache, SLAB_HWCACHE_ALIGN); 1380 1377 if (!mrt_cachep) 1381 1378 return -ENOMEM; 1382 1379
+2 -6
net/kcm/kcmsock.c
··· 1878 1878 { 1879 1879 int err = -ENOMEM; 1880 1880 1881 - kcm_muxp = kmem_cache_create("kcm_mux_cache", 1882 - sizeof(struct kcm_mux), 0, 1883 - SLAB_HWCACHE_ALIGN, NULL); 1881 + kcm_muxp = KMEM_CACHE(kcm_mux, SLAB_HWCACHE_ALIGN); 1884 1882 if (!kcm_muxp) 1885 1883 goto fail; 1886 1884 1887 - kcm_psockp = kmem_cache_create("kcm_psock_cache", 1888 - sizeof(struct kcm_psock), 0, 1889 - SLAB_HWCACHE_ALIGN, NULL); 1885 + kcm_psockp = KMEM_CACHE(kcm_psock, SLAB_HWCACHE_ALIGN); 1890 1886 if (!kcm_psockp) 1891 1887 goto fail; 1892 1888