[ovs-dev] [PATCH v2] datapath: Use percpu allocator for flow-stats.
Jesse Gross
jesse at nicira.com
Thu Dec 5 23:26:44 UTC 2013
On Thu, Dec 5, 2013 at 11:42 AM, Pravin B Shelar <pshelar at nicira.com> wrote:
> diff --git a/datapath/datapath.c b/datapath/datapath.c
> index 1a5bffb..48a2955 100644
> --- a/datapath/datapath.c
> +++ b/datapath/datapath.c
> @@ -766,6 +760,7 @@ static int ovs_flow_cmd_new_or_set(struct sk_buff *skb, struct genl_info *info)
> struct datapath *dp;
> struct sw_flow_actions *acts = NULL;
> struct sw_flow_match match;
> + bool em_5tuple;
What does 'em' stand for here? My guess is that it's 'exact match' but
if that's the case then I think exact_5tuple might be more
self-descriptive.
> diff --git a/datapath/flow_table.c b/datapath/flow_table.c
> index 8597651..252628d 100644
> --- a/datapath/flow_table.c
> +++ b/datapath/flow_table.c
> @@ -85,11 +85,28 @@ struct sw_flow *ovs_flow_alloc(void)
> flow->sf_acts = NULL;
> flow->mask = NULL;
>
> - memset(flow->stats, 0, num_possible_cpus() * sizeof(struct sw_flow_stats));
> - for_each_possible_cpu(cpu)
> - spin_lock_init(&flow->stats[cpu].lock);
> + flow->stats.is_percpu = percpu_stats;
>
> + if (!percpu_stats) {
> + flow->stats.stat = kzalloc(sizeof(*flow->stats.stat), GFP_KERNEL);
> + if (!flow->stats.stat)
> + goto err;
Don't we need to init the spin lock for this case?
More information about the dev
mailing list