[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+FuTSf-jJc5D_2js1-ZZU8kcaizzuKHjc-BY_Bqqk-9kaU+MA@mail.gmail.com>
Date: Tue, 23 Apr 2013 14:45:32 -0400
From: Willem de Bruijn <willemb@...gle.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: netdev@...r.kernel.org, David Miller <davem@...emloft.net>,
Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [PATCH net-next v2] rps: selective flow shedding during softnet overflow
On Mon, Apr 22, 2013 at 6:30 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> 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])
Thanks for the detailed explanation. I implemented the second
solution: make writes to the two sysctls mutually exclusive.
>
>
--
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