LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [PATCH net 4/4] ipvs: stats should not depend on CPU 0

To: Julian Anastasov <ja@xxxxxx>
Subject: Re: [PATCH net 4/4] ipvs: stats should not depend on CPU 0
Cc: Simon Horman <horms@xxxxxxxxxxxx>, lvs-devel@xxxxxxxxxxxxxxx
From: Hans Schillstrom <hans@xxxxxxxxxxxxxxx>
Date: Fri, 30 Aug 2013 09:46:08 +0200
On Wed, 2013-08-28 at 19:29 +0300, Julian Anastasov wrote:
> When reading percpu stats we need to properly reset
> the sum when CPU 0 is not present in the possible mask.

Not a very common case, but still possible.

> Signed-off-by: Julian Anastasov <ja@xxxxxx>

Acked-by: Hans Schillstrom <hans@xxxxxxxxxxxxxxx>

> ---
>  net/netfilter/ipvs/ip_vs_est.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c
> index 6bee6d0..1425e9a 100644
> --- a/net/netfilter/ipvs/ip_vs_est.c
> +++ b/net/netfilter/ipvs/ip_vs_est.c
> @@ -59,12 +59,13 @@ static void ip_vs_read_cpu_stats(struct ip_vs_stats_user 
> *sum,
>                                struct ip_vs_cpu_stats __percpu *stats)
>  {
>       int i;
> +     bool add = false;
>  
>       for_each_possible_cpu(i) {
>               struct ip_vs_cpu_stats *s = per_cpu_ptr(stats, i);
>               unsigned int start;
>               __u64 inbytes, outbytes;
> -             if (i) {
> +             if (add) {
>                       sum->conns += s->ustats.conns;
>                       sum->inpkts += s->ustats.inpkts;
>                       sum->outpkts += s->ustats.outpkts;
> @@ -76,6 +77,7 @@ static void ip_vs_read_cpu_stats(struct ip_vs_stats_user 
> *sum,
>                       sum->inbytes += inbytes;
>                       sum->outbytes += outbytes;
>               } else {
> +                     add = true;
>                       sum->conns = s->ustats.conns;
>                       sum->inpkts = s->ustats.inpkts;
>                       sum->outpkts = s->ustats.outpkts;

Attachment: smime.p7s
Description: S/MIME cryptographic signature

<Prev in Thread] Current Thread [Next in Thread>