diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2008-07-22 17:33:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-22 17:33:45 -0400 |
commit | 417f28bb340725544c36b35465444d2fd57232b8 (patch) | |
tree | 8a38097b4ea34a2877ecfdb95f37ad2864f5754d /net | |
parent | 888c848ed34bd5f8cb56567624c0d951ab35174e (diff) |
netns: dont alloc ipv6 fib timer list
FIB timer list is a trivial size structure, avoid indirection and just
put it in existing ns.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/ip6_fib.c | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 944095cf5e32..e0922975c410 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -661,16 +661,16 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
661 | 661 | ||
662 | static __inline__ void fib6_start_gc(struct net *net, struct rt6_info *rt) | 662 | static __inline__ void fib6_start_gc(struct net *net, struct rt6_info *rt) |
663 | { | 663 | { |
664 | if (!timer_pending(net->ipv6.ip6_fib_timer) && | 664 | if (!timer_pending(&net->ipv6.ip6_fib_timer) && |
665 | (rt->rt6i_flags & (RTF_EXPIRES|RTF_CACHE))) | 665 | (rt->rt6i_flags & (RTF_EXPIRES|RTF_CACHE))) |
666 | mod_timer(net->ipv6.ip6_fib_timer, | 666 | mod_timer(&net->ipv6.ip6_fib_timer, |
667 | jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); | 667 | jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); |
668 | } | 668 | } |
669 | 669 | ||
670 | void fib6_force_start_gc(struct net *net) | 670 | void fib6_force_start_gc(struct net *net) |
671 | { | 671 | { |
672 | if (!timer_pending(net->ipv6.ip6_fib_timer)) | 672 | if (!timer_pending(&net->ipv6.ip6_fib_timer)) |
673 | mod_timer(net->ipv6.ip6_fib_timer, | 673 | mod_timer(&net->ipv6.ip6_fib_timer, |
674 | jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); | 674 | jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); |
675 | } | 675 | } |
676 | 676 | ||
@@ -1449,7 +1449,7 @@ void fib6_run_gc(unsigned long expires, struct net *net) | |||
1449 | } else { | 1449 | } else { |
1450 | local_bh_disable(); | 1450 | local_bh_disable(); |
1451 | if (!spin_trylock(&fib6_gc_lock)) { | 1451 | if (!spin_trylock(&fib6_gc_lock)) { |
1452 | mod_timer(net->ipv6.ip6_fib_timer, jiffies + HZ); | 1452 | mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); |
1453 | local_bh_enable(); | 1453 | local_bh_enable(); |
1454 | return; | 1454 | return; |
1455 | } | 1455 | } |
@@ -1462,12 +1462,10 @@ void fib6_run_gc(unsigned long expires, struct net *net) | |||
1462 | fib6_clean_all(net, fib6_age, 0, NULL); | 1462 | fib6_clean_all(net, fib6_age, 0, NULL); |
1463 | 1463 | ||
1464 | if (gc_args.more) | 1464 | if (gc_args.more) |
1465 | mod_timer(net->ipv6.ip6_fib_timer, jiffies + | 1465 | mod_timer(&net->ipv6.ip6_fib_timer, jiffies + |
1466 | net->ipv6.sysctl.ip6_rt_gc_interval); | 1466 | net->ipv6.sysctl.ip6_rt_gc_interval); |
1467 | else { | 1467 | else |
1468 | del_timer(net->ipv6.ip6_fib_timer); | 1468 | del_timer(&net->ipv6.ip6_fib_timer); |
1469 | net->ipv6.ip6_fib_timer->expires = 0; | ||
1470 | } | ||
1471 | spin_unlock_bh(&fib6_gc_lock); | 1469 | spin_unlock_bh(&fib6_gc_lock); |
1472 | } | 1470 | } |
1473 | 1471 | ||
@@ -1478,16 +1476,7 @@ static void fib6_gc_timer_cb(unsigned long arg) | |||
1478 | 1476 | ||
1479 | static int fib6_net_init(struct net *net) | 1477 | static int fib6_net_init(struct net *net) |
1480 | { | 1478 | { |
1481 | int ret; | 1479 | setup_timer(&net->ipv6.ip6_fib_timer, fib6_gc_timer_cb, (unsigned long)net); |
1482 | struct timer_list *timer; | ||
1483 | |||
1484 | ret = -ENOMEM; | ||
1485 | timer = kzalloc(sizeof(*timer), GFP_KERNEL); | ||
1486 | if (!timer) | ||
1487 | goto out; | ||
1488 | |||
1489 | setup_timer(timer, fib6_gc_timer_cb, (unsigned long)net); | ||
1490 | net->ipv6.ip6_fib_timer = timer; | ||
1491 | 1480 | ||
1492 | net->ipv6.rt6_stats = kzalloc(sizeof(*net->ipv6.rt6_stats), GFP_KERNEL); | 1481 | net->ipv6.rt6_stats = kzalloc(sizeof(*net->ipv6.rt6_stats), GFP_KERNEL); |
1493 | if (!net->ipv6.rt6_stats) | 1482 | if (!net->ipv6.rt6_stats) |
@@ -1521,9 +1510,7 @@ static int fib6_net_init(struct net *net) | |||
1521 | #endif | 1510 | #endif |
1522 | fib6_tables_init(net); | 1511 | fib6_tables_init(net); |
1523 | 1512 | ||
1524 | ret = 0; | 1513 | return 0; |
1525 | out: | ||
1526 | return ret; | ||
1527 | 1514 | ||
1528 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | 1515 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
1529 | out_fib6_main_tbl: | 1516 | out_fib6_main_tbl: |
@@ -1534,15 +1521,14 @@ out_fib_table_hash: | |||
1534 | out_rt6_stats: | 1521 | out_rt6_stats: |
1535 | kfree(net->ipv6.rt6_stats); | 1522 | kfree(net->ipv6.rt6_stats); |
1536 | out_timer: | 1523 | out_timer: |
1537 | kfree(timer); | 1524 | return -ENOMEM; |
1538 | goto out; | ||
1539 | } | 1525 | } |
1540 | 1526 | ||
1541 | static void fib6_net_exit(struct net *net) | 1527 | static void fib6_net_exit(struct net *net) |
1542 | { | 1528 | { |
1543 | rt6_ifdown(net, NULL); | 1529 | rt6_ifdown(net, NULL); |
1544 | del_timer_sync(net->ipv6.ip6_fib_timer); | 1530 | del_timer_sync(&net->ipv6.ip6_fib_timer); |
1545 | kfree(net->ipv6.ip6_fib_timer); | 1531 | |
1546 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | 1532 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
1547 | kfree(net->ipv6.fib6_local_tbl); | 1533 | kfree(net->ipv6.fib6_local_tbl); |
1548 | #endif | 1534 | #endif |