From: Daniel Lezcano <dlezcano@fr.ibm.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH 2/6] netns: dont alloc ipv6 fib timer list
Date: Tue, 22 Jul 2008 04:20:56 +0200 [thread overview]
Message-ID: <48854408.9050804@fr.ibm.com> (raw)
In-Reply-To: <20080721192920.058840619@vyatta.com>
Stephen Hemminger wrote:
> 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>
>
> --- a/net/ipv6/ip6_fib.c 2008-07-21 11:57:29.000000000 -0700
> +++ b/net/ipv6/ip6_fib.c 2008-07-21 12:02:07.000000000 -0700
> @@ -661,16 +661,16 @@ static int fib6_add_rt2node(struct fib6_
>
> static void fib6_start_gc(struct net *net, struct rt6_info *rt)
> {
> - if (!timer_pending(net->ipv6.ip6_fib_timer) &&
> + if (!timer_pending(&net->ipv6.ip6_fib_timer) &&
> (rt->rt6i_flags & (RTF_EXPIRES|RTF_CACHE)))
> - mod_timer(net->ipv6.ip6_fib_timer, jiffies +
> + mod_timer(&net->ipv6.ip6_fib_timer, jiffies +
> net->ipv6.sysctl.ip6_rt_gc_interval);
> }
>
> void fib6_force_start_gc(struct net *net)
> {
> - if (!timer_pending(net->ipv6.ip6_fib_timer))
> - mod_timer(net->ipv6.ip6_fib_timer, jiffies +
> + if (!timer_pending(&net->ipv6.ip6_fib_timer))
> + mod_timer(&net->ipv6.ip6_fib_timer, jiffies +
> net->ipv6.sysctl.ip6_rt_gc_interval);
> }
>
> @@ -1449,7 +1449,7 @@ void fib6_run_gc(unsigned long expires,
> } else {
> local_bh_disable();
> if (!spin_trylock(&fib6_gc_lock)) {
> - mod_timer(net->ipv6.ip6_fib_timer, jiffies + HZ);
> + mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ);
> local_bh_enable();
> return;
> }
> @@ -1462,10 +1462,10 @@ void fib6_run_gc(unsigned long expires,
> fib6_clean_all(net, fib6_age, 0, NULL);
>
> if (gc_args.more)
> - mod_timer(net->ipv6.ip6_fib_timer, jiffies +
> + mod_timer(&net->ipv6.ip6_fib_timer, jiffies +
> net->ipv6.sysctl.ip6_rt_gc_interval);
> else
> - del_timer(net->ipv6.ip6_fib_timer);
> + del_timer(&net->ipv6.ip6_fib_timer);
> spin_unlock_bh(&fib6_gc_lock);
> }
>
> @@ -1476,16 +1476,7 @@ static void fib6_gc_timer_cb(unsigned lo
>
> static int fib6_net_init(struct net *net)
> {
> - int ret;
> - struct timer_list *timer;
> -
> - ret = -ENOMEM;
> - timer = kzalloc(sizeof(*timer), GFP_KERNEL);
> - if (!timer)
> - goto out;
> -
> - setup_timer(timer, fib6_gc_timer_cb, (unsigned long)net);
> - net->ipv6.ip6_fib_timer = timer;
> + setup_timer(&net->ipv6.ip6_fib_timer, fib6_gc_timer_cb, (unsigned long)net);
Perhaps I missed it, but I don't see in the patchset where is
ip6_fib_timer changed to be no longer a pointer in the netns ipv6 structure.
> net->ipv6.rt6_stats = kzalloc(sizeof(*net->ipv6.rt6_stats), GFP_KERNEL);
> if (!net->ipv6.rt6_stats)
> @@ -1519,9 +1510,7 @@ static int fib6_net_init(struct net *net
> #endif
> fib6_tables_init(net);
>
> - ret = 0;
> -out:
> - return ret;
> + return 0;
>
> #ifdef CONFIG_IPV6_MULTIPLE_TABLES
> out_fib6_main_tbl:
> @@ -1532,15 +1521,14 @@ out_fib_table_hash:
> out_rt6_stats:
> kfree(net->ipv6.rt6_stats);
> out_timer:
> - kfree(timer);
> - goto out;
> + return -ENOMEM;
> }
>
> static void fib6_net_exit(struct net *net)
> {
> rt6_ifdown(net, NULL);
> - del_timer_sync(net->ipv6.ip6_fib_timer);
> - kfree(net->ipv6.ip6_fib_timer);
> + del_timer_sync(&net->ipv6.ip6_fib_timer);
> +
> #ifdef CONFIG_IPV6_MULTIPLE_TABLES
> kfree(net->ipv6.fib6_local_tbl);
> #endif
next prev parent reply other threads:[~2008-07-22 2:21 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-21 19:28 [PATCH 0/6] IPV6 related gc bug + cleanups Stephen Hemminger
2008-07-21 19:28 ` [PATCH 1/6] ipv6: use timer pending Stephen Hemminger
2008-07-21 20:21 ` David Miller
2008-07-21 23:16 ` Ben Greear
2008-07-22 19:04 ` Stephen Hemminger
2008-07-22 19:10 ` Ben Greear
2008-07-23 0:35 ` Ben Greear
2008-07-21 19:28 ` [PATCH 2/6] netns: dont alloc ipv6 fib timer list Stephen Hemminger
2008-07-21 20:26 ` David Miller
2008-07-21 20:30 ` Stephen Hemminger
2008-07-21 20:33 ` David Miller
2008-07-21 20:44 ` [PATCH 2/3] netns: timer allocation Stephen Hemminger
2008-07-21 20:47 ` David Miller
2008-07-21 21:07 ` Stephen Hemminger
2008-07-21 23:28 ` David Miller
2008-07-22 2:20 ` Daniel Lezcano [this message]
2008-07-21 19:28 ` [PATCH 3/6] ipv6: use round_jiffies Stephen Hemminger
2008-07-21 19:28 ` [PATCH 4/6] ipv6: use spin_trylock_bh Stephen Hemminger
2008-07-21 19:28 ` [PATCH 5/6] ipv6: use kcalloc Stephen Hemminger
2008-07-21 19:28 ` [PATCH 6/6] ipv6: icmp6_dst_gc return change Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48854408.9050804@fr.ibm.com \
--to=dlezcano@fr.ibm.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.