Commit e5d679f33900c71d1a76ba07c5b04055abd34480
Committed by
David S. Miller
1 parent
ff5dfe736d
Exists in
master
and in
7 other branches
[NET]: Use SLAB_PANIC
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 12 changed files with 22 additions and 62 deletions Side-by-side Diff
net/core/flow.c
... | ... | @@ -343,12 +343,8 @@ |
343 | 343 | |
344 | 344 | flow_cachep = kmem_cache_create("flow_cache", |
345 | 345 | sizeof(struct flow_cache_entry), |
346 | - 0, SLAB_HWCACHE_ALIGN, | |
346 | + 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, | |
347 | 347 | NULL, NULL); |
348 | - | |
349 | - if (!flow_cachep) | |
350 | - panic("NET: failed to allocate flow cache slab\n"); | |
351 | - | |
352 | 348 | flow_hash_shift = 10; |
353 | 349 | flow_lwm = 2 * flow_hash_size; |
354 | 350 | flow_hwm = 4 * flow_hash_size; |
net/core/neighbour.c
... | ... | @@ -1339,14 +1339,10 @@ |
1339 | 1339 | neigh_rand_reach_time(tbl->parms.base_reachable_time); |
1340 | 1340 | |
1341 | 1341 | if (!tbl->kmem_cachep) |
1342 | - tbl->kmem_cachep = kmem_cache_create(tbl->id, | |
1343 | - tbl->entry_size, | |
1344 | - 0, SLAB_HWCACHE_ALIGN, | |
1345 | - NULL, NULL); | |
1346 | - | |
1347 | - if (!tbl->kmem_cachep) | |
1348 | - panic("cannot create neighbour cache"); | |
1349 | - | |
1342 | + tbl->kmem_cachep = | |
1343 | + kmem_cache_create(tbl->id, tbl->entry_size, 0, | |
1344 | + SLAB_HWCACHE_ALIGN|SLAB_PANIC, | |
1345 | + NULL, NULL); | |
1350 | 1346 | tbl->stats = alloc_percpu(struct neigh_statistics); |
1351 | 1347 | if (!tbl->stats) |
1352 | 1348 | panic("cannot create neighbour cache statistics"); |
net/core/skbuff.c
... | ... | @@ -2046,19 +2046,14 @@ |
2046 | 2046 | skbuff_head_cache = kmem_cache_create("skbuff_head_cache", |
2047 | 2047 | sizeof(struct sk_buff), |
2048 | 2048 | 0, |
2049 | - SLAB_HWCACHE_ALIGN, | |
2049 | + SLAB_HWCACHE_ALIGN|SLAB_PANIC, | |
2050 | 2050 | NULL, NULL); |
2051 | - if (!skbuff_head_cache) | |
2052 | - panic("cannot create skbuff cache"); | |
2053 | - | |
2054 | 2051 | skbuff_fclone_cache = kmem_cache_create("skbuff_fclone_cache", |
2055 | 2052 | (2*sizeof(struct sk_buff)) + |
2056 | 2053 | sizeof(atomic_t), |
2057 | 2054 | 0, |
2058 | - SLAB_HWCACHE_ALIGN, | |
2055 | + SLAB_HWCACHE_ALIGN|SLAB_PANIC, | |
2059 | 2056 | NULL, NULL); |
2060 | - if (!skbuff_fclone_cache) | |
2061 | - panic("cannot create skbuff cache"); | |
2062 | 2057 | } |
2063 | 2058 | |
2064 | 2059 | EXPORT_SYMBOL(___pskb_trim); |
net/decnet/dn_route.c
... | ... | @@ -1781,14 +1781,9 @@ |
1781 | 1781 | { |
1782 | 1782 | int i, goal, order; |
1783 | 1783 | |
1784 | - dn_dst_ops.kmem_cachep = kmem_cache_create("dn_dst_cache", | |
1785 | - sizeof(struct dn_route), | |
1786 | - 0, SLAB_HWCACHE_ALIGN, | |
1787 | - NULL, NULL); | |
1788 | - | |
1789 | - if (!dn_dst_ops.kmem_cachep) | |
1790 | - panic("DECnet: Failed to allocate dn_dst_cache\n"); | |
1791 | - | |
1784 | + dn_dst_ops.kmem_cachep = | |
1785 | + kmem_cache_create("dn_dst_cache", sizeof(struct dn_route), 0, | |
1786 | + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); | |
1792 | 1787 | init_timer(&dn_route_timer); |
1793 | 1788 | dn_route_timer.function = dn_dst_check_expire; |
1794 | 1789 | dn_route_timer.expires = jiffies + decnet_dst_gc_interval * HZ; |
net/ipv4/inetpeer.c
... | ... | @@ -126,11 +126,8 @@ |
126 | 126 | |
127 | 127 | peer_cachep = kmem_cache_create("inet_peer_cache", |
128 | 128 | sizeof(struct inet_peer), |
129 | - 0, SLAB_HWCACHE_ALIGN, | |
129 | + 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, | |
130 | 130 | NULL, NULL); |
131 | - | |
132 | - if (!peer_cachep) | |
133 | - panic("cannot create inet_peer_cache"); | |
134 | 131 | |
135 | 132 | /* All the timers, started at system startup tend |
136 | 133 | to synchronize. Perturb it a bit. |
net/ipv4/ipmr.c
... | ... | @@ -1900,11 +1900,8 @@ |
1900 | 1900 | { |
1901 | 1901 | mrt_cachep = kmem_cache_create("ip_mrt_cache", |
1902 | 1902 | sizeof(struct mfc_cache), |
1903 | - 0, SLAB_HWCACHE_ALIGN, | |
1903 | + 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, | |
1904 | 1904 | NULL, NULL); |
1905 | - if (!mrt_cachep) | |
1906 | - panic("cannot allocate ip_mrt_cache"); | |
1907 | - | |
1908 | 1905 | init_timer(&ipmr_expire_timer); |
1909 | 1906 | ipmr_expire_timer.function=ipmr_expire_process; |
1910 | 1907 | register_netdevice_notifier(&ip_mr_notifier); |
net/ipv4/route.c
... | ... | @@ -3147,13 +3147,9 @@ |
3147 | 3147 | } |
3148 | 3148 | #endif |
3149 | 3149 | |
3150 | - ipv4_dst_ops.kmem_cachep = kmem_cache_create("ip_dst_cache", | |
3151 | - sizeof(struct rtable), | |
3152 | - 0, SLAB_HWCACHE_ALIGN, | |
3153 | - NULL, NULL); | |
3154 | - | |
3155 | - if (!ipv4_dst_ops.kmem_cachep) | |
3156 | - panic("IP: failed to allocate ip_dst_cache\n"); | |
3150 | + ipv4_dst_ops.kmem_cachep = | |
3151 | + kmem_cache_create("ip_dst_cache", sizeof(struct rtable), 0, | |
3152 | + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); | |
3157 | 3153 | |
3158 | 3154 | rt_hash_table = (struct rt_hash_bucket *) |
3159 | 3155 | alloc_large_system_hash("IP route cache", |
net/ipv4/tcp.c
... | ... | @@ -2254,9 +2254,7 @@ |
2254 | 2254 | tcp_hashinfo.bind_bucket_cachep = |
2255 | 2255 | kmem_cache_create("tcp_bind_bucket", |
2256 | 2256 | sizeof(struct inet_bind_bucket), 0, |
2257 | - SLAB_HWCACHE_ALIGN, NULL, NULL); | |
2258 | - if (!tcp_hashinfo.bind_bucket_cachep) | |
2259 | - panic("tcp_init: Cannot alloc tcp_bind_bucket cache."); | |
2257 | + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); | |
2260 | 2258 | |
2261 | 2259 | /* Size and allocate the main established and bind bucket |
2262 | 2260 | * hash tables. |
net/ipv6/ip6_fib.c
... | ... | @@ -1472,10 +1472,8 @@ |
1472 | 1472 | { |
1473 | 1473 | fib6_node_kmem = kmem_cache_create("fib6_nodes", |
1474 | 1474 | sizeof(struct fib6_node), |
1475 | - 0, SLAB_HWCACHE_ALIGN, | |
1475 | + 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, | |
1476 | 1476 | NULL, NULL); |
1477 | - if (!fib6_node_kmem) | |
1478 | - panic("cannot create fib6_nodes cache"); | |
1479 | 1477 | |
1480 | 1478 | fib6_tables_init(); |
1481 | 1479 | } |
net/ipv6/route.c
... | ... | @@ -2419,13 +2419,9 @@ |
2419 | 2419 | { |
2420 | 2420 | struct proc_dir_entry *p; |
2421 | 2421 | |
2422 | - ip6_dst_ops.kmem_cachep = kmem_cache_create("ip6_dst_cache", | |
2423 | - sizeof(struct rt6_info), | |
2424 | - 0, SLAB_HWCACHE_ALIGN, | |
2425 | - NULL, NULL); | |
2426 | - if (!ip6_dst_ops.kmem_cachep) | |
2427 | - panic("cannot create ip6_dst_cache"); | |
2428 | - | |
2422 | + ip6_dst_ops.kmem_cachep = | |
2423 | + kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0, | |
2424 | + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); | |
2429 | 2425 | fib6_init(); |
2430 | 2426 | #ifdef CONFIG_PROC_FS |
2431 | 2427 | p = proc_net_create("ipv6_route", 0, rt6_proc_info); |
net/xfrm/xfrm_input.c
net/xfrm/xfrm_policy.c
... | ... | @@ -1985,10 +1985,8 @@ |
1985 | 1985 | |
1986 | 1986 | xfrm_dst_cache = kmem_cache_create("xfrm_dst_cache", |
1987 | 1987 | sizeof(struct xfrm_dst), |
1988 | - 0, SLAB_HWCACHE_ALIGN, | |
1988 | + 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, | |
1989 | 1989 | NULL, NULL); |
1990 | - if (!xfrm_dst_cache) | |
1991 | - panic("XFRM: failed to allocate xfrm_dst_cache\n"); | |
1992 | 1990 | |
1993 | 1991 | hmask = 8 - 1; |
1994 | 1992 | sz = (hmask+1) * sizeof(struct hlist_head); |