Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1215803

Re: [PATCH RFC V3 2/2] net: Optimize snmp stat aggregation by walking all the percpu data at once

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH RFC V3 2/2] net: Optimize snmp stat aggregation by walking all the percpu data at once
Date 2015-08-29 17:30 +0200
Message-ID <q2QeS-5LL-1@gated-at.bofh.it> (permalink)
References <ds889-8u2-7@gated-at.bofh.it> <q2Kj7-5Iz-13@gated-at.bofh.it> <q2Kj7-5Iz-11@gated-at.bofh.it> <q2Pst-4AG-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, 2015-08-29 at 07:32 -0700, Eric Dumazet wrote:
> On Sat, 2015-08-29 at 14:37 +0530, Raghavendra K T wrote:
> 
> >  
> >  static inline void __snmp6_fill_stats64(u64 *stats, void __percpu *mib,
> > -				      int items, int bytes, size_t syncpoff)
> > +					int items, int bytes, size_t syncpoff)
> >  {
> > -	int i;
> > +	int i, c;
> >  	int pad = bytes - sizeof(u64) * items;
> > +	u64 buff[items];
> > +
> 
> One last comment : using variable length arrays is confusing for the
> reader, and sparse as well.
> 
> $ make C=2 net/ipv6/addrconf.o
> ...
>   CHECK   net/ipv6/addrconf.c
> net/ipv6/addrconf.c:4733:18: warning: Variable length array is used.
> net/ipv6/addrconf.c:4737:25: error: cannot size expression
> 
> 
> I suggest you remove 'items' parameter and replace it by
> IPSTATS_MIB_MAX, as __snmp6_fill_stats64() is called exactly once.

If you respin, I suggest:

o remove "items" from the __snmp6_fill_stats64 arguments
  and use IPSTATS_MIB_MAX in the function instead

o add braces around the for_each_possible_cpu loop

	for_each_possible_cpu(c) {
		for (i = 1; i < items; i++)
			buff[i] += snmp_get_cpu_field64(mib, c, i, syncpoff);
	}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH RFC V3 2/2] net: Optimize snmp stat aggregation by walking all the percpu data at once Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com> - 2015-08-29 11:10 +0200
  Re: [PATCH RFC V3 2/2] net: Optimize snmp stat aggregation by  walking all the percpu data at once Eric Dumazet <eric.dumazet@gmail.com> - 2015-08-29 16:40 +0200
    Re: [PATCH RFC V3 2/2] net: Optimize snmp stat aggregation by  walking all the percpu data at once Joe Perches <joe@perches.com> - 2015-08-29 17:30 +0200
      Re: [PATCH RFC V3 2/2] net: Optimize snmp stat aggregation by walking  all the percpu data at once Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com> - 2015-08-29 19:30 +0200

csiph-web