[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170831085802.2d4cdc87@xeon-e3>
Date: Thu, 31 Aug 2017 08:58:02 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Jesper Dangaard Brouer <brouer@...hat.com>
Cc: liujian56@...wei.com, netdev@...r.kernel.org,
Florian Westphal <fw@...len.de>
Subject: Re: [RFC PATCH] net: frag limit checks need to use
percpu_counter_compare
On Thu, 31 Aug 2017 12:20:19 +0200
Jesper Dangaard Brouer <brouer@...hat.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;
Powered by blists - more mailing lists