const struct sk_buff *skb)
 {
        struct flow_stats *stats;
-       int cpu = smp_processor_id();
+       unsigned int cpu = smp_processor_id();
        int len = skb->len + (skb_vlan_tag_present(skb) ? VLAN_HLEN : 0);
 
        stats = rcu_dereference(flow->stats[cpu]);
 
                                        rcu_assign_pointer(flow->stats[cpu],
                                                           new_stats);
+                                       cpumask_set_cpu(cpu, &flow->cpu_used_mask);
                                        goto unlock;
                                }
                        }
        memset(ovs_stats, 0, sizeof(*ovs_stats));
 
        /* We open code this to make sure cpu 0 is always considered */
-       for (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, cpu_possible_mask)) {
+       for (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, &flow->cpu_used_mask)) {
                struct flow_stats *stats = rcu_dereference_ovsl(flow->stats[cpu]);
 
                if (stats) {
        int cpu;
 
        /* We open code this to make sure cpu 0 is always considered */
-       for (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, cpu_possible_mask)) {
+       for (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, &flow->cpu_used_mask)) {
                struct flow_stats *stats = ovsl_dereference(flow->stats[cpu]);
 
                if (stats) {
 
 #include <linux/jiffies.h>
 #include <linux/time.h>
 #include <linux/flex_array.h>
+#include <linux/cpumask.h>
 #include <net/inet_ecn.h>
 #include <net/ip_tunnels.h>
 #include <net/dst_metadata.h>
                                         */
        struct sw_flow_key key;
        struct sw_flow_id id;
+       struct cpumask cpu_used_mask;
        struct sw_flow_mask *mask;
        struct sw_flow_actions __rcu *sf_acts;
        struct flow_stats __rcu *stats[]; /* One for each CPU.  First one
 
 
        RCU_INIT_POINTER(flow->stats[0], stats);
 
+       cpumask_set_cpu(0, &flow->cpu_used_mask);
+
        return flow;
 err:
        kmem_cache_free(flow_cache, flow);
        if (flow->sf_acts)
                ovs_nla_free_flow_actions((struct sw_flow_actions __force *)flow->sf_acts);
        /* We open code this to make sure cpu 0 is always considered */
-       for (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, cpu_possible_mask))
+       for (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, &flow->cpu_used_mask))
                if (flow->stats[cpu])
                        kmem_cache_free(flow_stats_cache,
                                        (struct flow_stats __force *)flow->stats[cpu]);