[NET]: Use SLAB_PANIC
authorAlexey Dobriyan <adobriyan@gmail.com>
Sun, 27 Aug 2006 02:25:52 +0000 (19:25 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 22 Sep 2006 22:18:19 +0000 (15:18 -0700)
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 files changed:
net/core/flow.c
net/core/neighbour.c
net/core/skbuff.c
net/decnet/dn_route.c
net/ipv4/inetpeer.c
net/ipv4/ipmr.c
net/ipv4/route.c
net/ipv4/tcp.c
net/ipv6/ip6_fib.c
net/ipv6/route.c
net/xfrm/xfrm_input.c
net/xfrm/xfrm_policy.c

index 645241165e6cfce76283f76eceb9bca0de8ace3e..f23e7e38654319682cd2f92d8feadf5c172615f1 100644 (file)
@@ -343,12 +343,8 @@ static int __init flow_cache_init(void)
 
        flow_cachep = kmem_cache_create("flow_cache",
                                        sizeof(struct flow_cache_entry),
-                                       0, SLAB_HWCACHE_ALIGN,
+                                       0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
                                        NULL, NULL);
-
-       if (!flow_cachep)
-               panic("NET: failed to allocate flow cache slab\n");
-
        flow_hash_shift = 10;
        flow_lwm = 2 * flow_hash_size;
        flow_hwm = 4 * flow_hash_size;
index c0a27407f44528409b09026110c8efc584d4867b..a45bd2124d6b21a3c93c1aa846a780e759c20f40 100644 (file)
@@ -1339,14 +1339,10 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
                          neigh_rand_reach_time(tbl->parms.base_reachable_time);
 
        if (!tbl->kmem_cachep)
-               tbl->kmem_cachep = kmem_cache_create(tbl->id,
-                                                    tbl->entry_size,
-                                                    0, SLAB_HWCACHE_ALIGN,
-                                                    NULL, NULL);
-
-       if (!tbl->kmem_cachep)
-               panic("cannot create neighbour cache");
-
+               tbl->kmem_cachep =
+                       kmem_cache_create(tbl->id, tbl->entry_size, 0,
+                                         SLAB_HWCACHE_ALIGN|SLAB_PANIC,
+                                         NULL, NULL);
        tbl->stats = alloc_percpu(struct neigh_statistics);
        if (!tbl->stats)
                panic("cannot create neighbour cache statistics");
index 8a476f1956e5868e947aa9a4834349b83cdd0855..c448c7f6fde2a002b7549076e3c4d98e83a1194c 100644 (file)
@@ -2046,19 +2046,14 @@ void __init skb_init(void)
        skbuff_head_cache = kmem_cache_create("skbuff_head_cache",
                                              sizeof(struct sk_buff),
                                              0,
-                                             SLAB_HWCACHE_ALIGN,
+                                             SLAB_HWCACHE_ALIGN|SLAB_PANIC,
                                              NULL, NULL);
-       if (!skbuff_head_cache)
-               panic("cannot create skbuff cache");
-
        skbuff_fclone_cache = kmem_cache_create("skbuff_fclone_cache",
                                                (2*sizeof(struct sk_buff)) +
                                                sizeof(atomic_t),
                                                0,
-                                               SLAB_HWCACHE_ALIGN,
+                                               SLAB_HWCACHE_ALIGN|SLAB_PANIC,
                                                NULL, NULL);
-       if (!skbuff_fclone_cache)
-               panic("cannot create skbuff cache");
 }
 
 EXPORT_SYMBOL(___pskb_trim);
index c5daf3557c1f12bca571a086f0970b307028984c..dd0761e3d280cc311cbdf88b278b5e91cd4951ab 100644 (file)
@@ -1781,14 +1781,9 @@ void __init dn_route_init(void)
 {
        int i, goal, order;
 
-       dn_dst_ops.kmem_cachep = kmem_cache_create("dn_dst_cache",
-                                                  sizeof(struct dn_route),
-                                                  0, SLAB_HWCACHE_ALIGN,
-                                                  NULL, NULL);
-
-       if (!dn_dst_ops.kmem_cachep)
-               panic("DECnet: Failed to allocate dn_dst_cache\n");
-
+       dn_dst_ops.kmem_cachep =
+               kmem_cache_create("dn_dst_cache", sizeof(struct dn_route), 0,
+                                 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
        init_timer(&dn_route_timer);
        dn_route_timer.function = dn_dst_check_expire;
        dn_route_timer.expires = jiffies + decnet_dst_gc_interval * HZ;
index 03ff62ebcfeb5fc02473c211a1abe8e19e1bfe9c..a675602ef2953acf12d33096657c8bb09689a4af 100644 (file)
@@ -126,12 +126,9 @@ void __init inet_initpeers(void)
 
        peer_cachep = kmem_cache_create("inet_peer_cache",
                        sizeof(struct inet_peer),
-                       0, SLAB_HWCACHE_ALIGN,
+                       0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
                        NULL, NULL);
 
-       if (!peer_cachep)
-               panic("cannot create inet_peer_cache");
-
        /* All the timers, started at system startup tend
           to synchronize. Perturb it a bit.
         */
index 98f0aa0d421604025c57faad16562ca12005724e..ba49588da2424f70e4d6fa483839db279b30890e 100644 (file)
@@ -1900,11 +1900,8 @@ void __init ip_mr_init(void)
 {
        mrt_cachep = kmem_cache_create("ip_mrt_cache",
                                       sizeof(struct mfc_cache),
-                                      0, SLAB_HWCACHE_ALIGN,
+                                      0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
                                       NULL, NULL);
-       if (!mrt_cachep)
-               panic("cannot allocate ip_mrt_cache");
-
        init_timer(&ipmr_expire_timer);
        ipmr_expire_timer.function=ipmr_expire_process;
        register_netdevice_notifier(&ip_mr_notifier);
index a4d4cb85a16c27fa81600fdf6b4d67a42425f820..20ffe8e88c0f0809d28418743fb81fd5cc43bc02 100644 (file)
@@ -3147,13 +3147,9 @@ int __init ip_rt_init(void)
        }
 #endif
 
-       ipv4_dst_ops.kmem_cachep = kmem_cache_create("ip_dst_cache",
-                                                    sizeof(struct rtable),
-                                                    0, SLAB_HWCACHE_ALIGN,
-                                                    NULL, NULL);
-
-       if (!ipv4_dst_ops.kmem_cachep)
-               panic("IP: failed to allocate ip_dst_cache\n");
+       ipv4_dst_ops.kmem_cachep =
+               kmem_cache_create("ip_dst_cache", sizeof(struct rtable), 0,
+                                 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 
        rt_hash_table = (struct rt_hash_bucket *)
                alloc_large_system_hash("IP route cache",
index e570db4d33c84055964def7043288f90f85566da..29e3d606db78d6fab90ade17b417c97fe6a0f60b 100644 (file)
@@ -2254,9 +2254,7 @@ void __init tcp_init(void)
        tcp_hashinfo.bind_bucket_cachep =
                kmem_cache_create("tcp_bind_bucket",
                                  sizeof(struct inet_bind_bucket), 0,
-                                 SLAB_HWCACHE_ALIGN, NULL, NULL);
-       if (!tcp_hashinfo.bind_bucket_cachep)
-               panic("tcp_init: Cannot alloc tcp_bind_bucket cache.");
+                                 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 
        /* Size and allocate the main established and bind bucket
         * hash tables.
index fbca60950b147ce1859b1c99683243b5adc240d4..8fcae7a6510b9fdeb793bfc395de458daee4ddc2 100644 (file)
@@ -1472,10 +1472,8 @@ void __init fib6_init(void)
 {
        fib6_node_kmem = kmem_cache_create("fib6_nodes",
                                           sizeof(struct fib6_node),
-                                          0, SLAB_HWCACHE_ALIGN,
+                                          0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
                                           NULL, NULL);
-       if (!fib6_node_kmem)
-               panic("cannot create fib6_nodes cache");
 
        fib6_tables_init();
 }
index d83844d9499bf487dfda81aa8a80506959b478e8..ba1b3d11865e43c2553d352179625e9e4b4fad37 100644 (file)
@@ -2419,13 +2419,9 @@ void __init ip6_route_init(void)
 {
        struct proc_dir_entry *p;
 
-       ip6_dst_ops.kmem_cachep = kmem_cache_create("ip6_dst_cache",
-                                                    sizeof(struct rt6_info),
-                                                    0, SLAB_HWCACHE_ALIGN,
-                                                    NULL, NULL);
-       if (!ip6_dst_ops.kmem_cachep)
-               panic("cannot create ip6_dst_cache");
-
+       ip6_dst_ops.kmem_cachep =
+               kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0,
+                                 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
        fib6_init();
 #ifdef         CONFIG_PROC_FS
        p = proc_net_create("ipv6_route", 0, rt6_proc_info);
index 891a6090cc099d2f88e15aa33ff68db982132d6e..dfc90bb1cf1f53d054c2fc7f15e0b72ed3013f2a 100644 (file)
@@ -82,8 +82,6 @@ void __init xfrm_input_init(void)
 {
        secpath_cachep = kmem_cache_create("secpath_cache",
                                           sizeof(struct sec_path),
-                                          0, SLAB_HWCACHE_ALIGN,
+                                          0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
                                           NULL, NULL);
-       if (!secpath_cachep)
-               panic("XFRM: failed to allocate secpath_cache\n");
 }
index 1cf3209cdf4b371543ab53a1365766913082482e..7db1c48537f0d573ff29981e2548dc93183927ab 100644 (file)
@@ -1985,10 +1985,8 @@ static void __init xfrm_policy_init(void)
 
        xfrm_dst_cache = kmem_cache_create("xfrm_dst_cache",
                                           sizeof(struct xfrm_dst),
-                                          0, SLAB_HWCACHE_ALIGN,
+                                          0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
                                           NULL, NULL);
-       if (!xfrm_dst_cache)
-               panic("XFRM: failed to allocate xfrm_dst_cache\n");
 
        hmask = 8 - 1;
        sz = (hmask+1) * sizeof(struct hlist_head);