[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1366669808.16391.90.camel@edumazet-glaptop>
Date: Mon, 22 Apr 2013 15:30:08 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Willem de Bruijn <willemb@...gle.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net,
stephen@...workplumber.org
Subject: Re: [PATCH net-next v2] rps: selective flow shedding during softnet
overflow
On Mon, 2013-04-22 at 16:46 -0400, Willem de Bruijn wrote:
> + len = sizeof(*cur) + netdev_flow_limit_table_len;
[1]
> + mutex_lock(&flow_limit_update_mutex);
[2]
> + for_each_possible_cpu(i) {
> + sd = &per_cpu(softnet_data, i);
> + cur = rcu_dereference_protected(sd->flow_limit,
> + lockdep_is_held(flow_limit_update_mutex));
> + if (cur && !cpumask_test_cpu(i, mask)) {
> + RCU_INIT_POINTER(sd->flow_limit, NULL);
> + synchronize_rcu();
> + kfree(cur);
> + } else if (!cur && cpumask_test_cpu(i, mask)) {
> + cur = kzalloc(len, GFP_KERNEL);
> + cur->num_buckets = netdev_flow_limit_table_len;
[3]
Its a bit tricky, but the value of netdev_flow_limit_table_len could
change between [1] and [3]
So you should read its value once, or protect the whole thing using
mutex_lock(&flow_limit_update_mutex) in sysctl code ( and move [1] after
[2])
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists