On Thu, 31 Aug 2017 12:20:19 +0200 Jesper Dangaard Brouer <bro...@redhat.com> wrote:
> +static inline bool frag_mem_over_limit(struct netns_frags *nf, int thresh) > { > - return percpu_counter_read(&nf->mem); > + /* When reading counter here, __percpu_counter_compare() call > + * will invoke __percpu_counter_sum() when needed. Which > + * depend on num_online_cpus()*batch size, as each CPU can > + * potentential can hold a batch count. > + * > + * With many CPUs this heavier sum operation will > + * unfortunately always occur. > + */ > + if (__percpu_counter_compare(&nf->mem, thresh, > + frag_percpu_counter_batch) > 0) > + return true; > + else > + return false; You don't need an if() here. return __percpu_counter_compare(&nf->mem, thresh, frag_percpu_counter_batch) > 0;