Commit e5d679f3 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by David S. Miller

[NET]: Use SLAB_PANIC

Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ff5dfe73
...@@ -343,12 +343,8 @@ static int __init flow_cache_init(void) ...@@ -343,12 +343,8 @@ static int __init flow_cache_init(void)
flow_cachep = kmem_cache_create("flow_cache", flow_cachep = kmem_cache_create("flow_cache",
sizeof(struct flow_cache_entry), sizeof(struct flow_cache_entry),
0, SLAB_HWCACHE_ALIGN, 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
NULL, NULL); NULL, NULL);
if (!flow_cachep)
panic("NET: failed to allocate flow cache slab\n");
flow_hash_shift = 10; flow_hash_shift = 10;
flow_lwm = 2 * flow_hash_size; flow_lwm = 2 * flow_hash_size;
flow_hwm = 4 * flow_hash_size; flow_hwm = 4 * flow_hash_size;
......
...@@ -1339,14 +1339,10 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl) ...@@ -1339,14 +1339,10 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
neigh_rand_reach_time(tbl->parms.base_reachable_time); neigh_rand_reach_time(tbl->parms.base_reachable_time);
if (!tbl->kmem_cachep) if (!tbl->kmem_cachep)
tbl->kmem_cachep = kmem_cache_create(tbl->id, tbl->kmem_cachep =
tbl->entry_size, kmem_cache_create(tbl->id, tbl->entry_size, 0,
0, SLAB_HWCACHE_ALIGN, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
NULL, NULL); NULL, NULL);
if (!tbl->kmem_cachep)
panic("cannot create neighbour cache");
tbl->stats = alloc_percpu(struct neigh_statistics); tbl->stats = alloc_percpu(struct neigh_statistics);
if (!tbl->stats) if (!tbl->stats)
panic("cannot create neighbour cache statistics"); panic("cannot create neighbour cache statistics");
......
...@@ -2046,19 +2046,14 @@ void __init skb_init(void) ...@@ -2046,19 +2046,14 @@ void __init skb_init(void)
skbuff_head_cache = kmem_cache_create("skbuff_head_cache", skbuff_head_cache = kmem_cache_create("skbuff_head_cache",
sizeof(struct sk_buff), sizeof(struct sk_buff),
0, 0,
SLAB_HWCACHE_ALIGN, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
NULL, NULL); NULL, NULL);
if (!skbuff_head_cache)
panic("cannot create skbuff cache");
skbuff_fclone_cache = kmem_cache_create("skbuff_fclone_cache", skbuff_fclone_cache = kmem_cache_create("skbuff_fclone_cache",
(2*sizeof(struct sk_buff)) + (2*sizeof(struct sk_buff)) +
sizeof(atomic_t), sizeof(atomic_t),
0, 0,
SLAB_HWCACHE_ALIGN, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
NULL, NULL); NULL, NULL);
if (!skbuff_fclone_cache)
panic("cannot create skbuff cache");
} }
EXPORT_SYMBOL(___pskb_trim); EXPORT_SYMBOL(___pskb_trim);
......
...@@ -1781,14 +1781,9 @@ void __init dn_route_init(void) ...@@ -1781,14 +1781,9 @@ void __init dn_route_init(void)
{ {
int i, goal, order; int i, goal, order;
dn_dst_ops.kmem_cachep = kmem_cache_create("dn_dst_cache", dn_dst_ops.kmem_cachep =
sizeof(struct dn_route), kmem_cache_create("dn_dst_cache", sizeof(struct dn_route), 0,
0, SLAB_HWCACHE_ALIGN, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
NULL, NULL);
if (!dn_dst_ops.kmem_cachep)
panic("DECnet: Failed to allocate dn_dst_cache\n");
init_timer(&dn_route_timer); init_timer(&dn_route_timer);
dn_route_timer.function = dn_dst_check_expire; dn_route_timer.function = dn_dst_check_expire;
dn_route_timer.expires = jiffies + decnet_dst_gc_interval * HZ; dn_route_timer.expires = jiffies + decnet_dst_gc_interval * HZ;
......
...@@ -126,12 +126,9 @@ void __init inet_initpeers(void) ...@@ -126,12 +126,9 @@ void __init inet_initpeers(void)
peer_cachep = kmem_cache_create("inet_peer_cache", peer_cachep = kmem_cache_create("inet_peer_cache",
sizeof(struct inet_peer), sizeof(struct inet_peer),
0, SLAB_HWCACHE_ALIGN, 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
NULL, NULL); NULL, NULL);
if (!peer_cachep)
panic("cannot create inet_peer_cache");
/* All the timers, started at system startup tend /* All the timers, started at system startup tend
to synchronize. Perturb it a bit. to synchronize. Perturb it a bit.
*/ */
......
...@@ -1900,11 +1900,8 @@ void __init ip_mr_init(void) ...@@ -1900,11 +1900,8 @@ void __init ip_mr_init(void)
{ {
mrt_cachep = kmem_cache_create("ip_mrt_cache", mrt_cachep = kmem_cache_create("ip_mrt_cache",
sizeof(struct mfc_cache), sizeof(struct mfc_cache),
0, SLAB_HWCACHE_ALIGN, 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
NULL, NULL); NULL, NULL);
if (!mrt_cachep)
panic("cannot allocate ip_mrt_cache");
init_timer(&ipmr_expire_timer); init_timer(&ipmr_expire_timer);
ipmr_expire_timer.function=ipmr_expire_process; ipmr_expire_timer.function=ipmr_expire_process;
register_netdevice_notifier(&ip_mr_notifier); register_netdevice_notifier(&ip_mr_notifier);
......
...@@ -3147,13 +3147,9 @@ int __init ip_rt_init(void) ...@@ -3147,13 +3147,9 @@ int __init ip_rt_init(void)
} }
#endif #endif
ipv4_dst_ops.kmem_cachep = kmem_cache_create("ip_dst_cache", ipv4_dst_ops.kmem_cachep =
sizeof(struct rtable), kmem_cache_create("ip_dst_cache", sizeof(struct rtable), 0,
0, SLAB_HWCACHE_ALIGN, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
NULL, NULL);
if (!ipv4_dst_ops.kmem_cachep)
panic("IP: failed to allocate ip_dst_cache\n");
rt_hash_table = (struct rt_hash_bucket *) rt_hash_table = (struct rt_hash_bucket *)
alloc_large_system_hash("IP route cache", alloc_large_system_hash("IP route cache",
......
...@@ -2254,9 +2254,7 @@ void __init tcp_init(void) ...@@ -2254,9 +2254,7 @@ void __init tcp_init(void)
tcp_hashinfo.bind_bucket_cachep = tcp_hashinfo.bind_bucket_cachep =
kmem_cache_create("tcp_bind_bucket", kmem_cache_create("tcp_bind_bucket",
sizeof(struct inet_bind_bucket), 0, sizeof(struct inet_bind_bucket), 0,
SLAB_HWCACHE_ALIGN, NULL, NULL); SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
if (!tcp_hashinfo.bind_bucket_cachep)
panic("tcp_init: Cannot alloc tcp_bind_bucket cache.");
/* Size and allocate the main established and bind bucket /* Size and allocate the main established and bind bucket
* hash tables. * hash tables.
......
...@@ -1472,10 +1472,8 @@ void __init fib6_init(void) ...@@ -1472,10 +1472,8 @@ void __init fib6_init(void)
{ {
fib6_node_kmem = kmem_cache_create("fib6_nodes", fib6_node_kmem = kmem_cache_create("fib6_nodes",
sizeof(struct fib6_node), sizeof(struct fib6_node),
0, SLAB_HWCACHE_ALIGN, 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
NULL, NULL); NULL, NULL);
if (!fib6_node_kmem)
panic("cannot create fib6_nodes cache");
fib6_tables_init(); fib6_tables_init();
} }
......
...@@ -2419,13 +2419,9 @@ void __init ip6_route_init(void) ...@@ -2419,13 +2419,9 @@ void __init ip6_route_init(void)
{ {
struct proc_dir_entry *p; struct proc_dir_entry *p;
ip6_dst_ops.kmem_cachep = kmem_cache_create("ip6_dst_cache", ip6_dst_ops.kmem_cachep =
sizeof(struct rt6_info), kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0,
0, SLAB_HWCACHE_ALIGN, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
NULL, NULL);
if (!ip6_dst_ops.kmem_cachep)
panic("cannot create ip6_dst_cache");
fib6_init(); fib6_init();
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
p = proc_net_create("ipv6_route", 0, rt6_proc_info); p = proc_net_create("ipv6_route", 0, rt6_proc_info);
......
...@@ -82,8 +82,6 @@ void __init xfrm_input_init(void) ...@@ -82,8 +82,6 @@ void __init xfrm_input_init(void)
{ {
secpath_cachep = kmem_cache_create("secpath_cache", secpath_cachep = kmem_cache_create("secpath_cache",
sizeof(struct sec_path), sizeof(struct sec_path),
0, SLAB_HWCACHE_ALIGN, 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
NULL, NULL); NULL, NULL);
if (!secpath_cachep)
panic("XFRM: failed to allocate secpath_cache\n");
} }
...@@ -1985,10 +1985,8 @@ static void __init xfrm_policy_init(void) ...@@ -1985,10 +1985,8 @@ static void __init xfrm_policy_init(void)
xfrm_dst_cache = kmem_cache_create("xfrm_dst_cache", xfrm_dst_cache = kmem_cache_create("xfrm_dst_cache",
sizeof(struct xfrm_dst), sizeof(struct xfrm_dst),
0, SLAB_HWCACHE_ALIGN, 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
NULL, NULL); NULL, NULL);
if (!xfrm_dst_cache)
panic("XFRM: failed to allocate xfrm_dst_cache\n");
hmask = 8 - 1; hmask = 8 - 1;
sz = (hmask+1) * sizeof(struct hlist_head); sz = (hmask+1) * sizeof(struct hlist_head);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment