netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
To: Joe Perches <joe@perches.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	davem@davemloft.net, kuznet@ms2.inr.ac.ru, jmorris@namei.org,
	yoshfuji@linux-ipv6.org, kaber@trash.net, jiri@resnulli.us,
	edumazet@google.com, hannes@stressinduktion.org,
	tom@herbertland.com, azhou@nicira.com, ebiederm@xmission.com,
	ipm@chirality.org.uk, nicolas.dichtel@6wind.com,
	serge.hallyn@canonical.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, anton@au1.ibm.com,
	nacc@linux.vnet.ibm.com, srikar@linux.vnet.ibm.com
Subject: Re: [PATCH RFC V3 2/2] net: Optimize snmp stat aggregation by walking all the percpu data at once
Date: Sat, 29 Aug 2015 22:55:40 +0530	[thread overview]
Message-ID: <55E1EB14.5040205@linux.vnet.ibm.com> (raw)
In-Reply-To: <1440861684.3276.7.camel@perches.com>

On 08/29/2015 08:51 PM, Joe Perches wrote:
> 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

Yes, as also suggested by Eric.

> 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);
> 	}
>

Sure. It makes it more readable.
will respin V4 with these changes (+ memset 0 for pad which I realized).

      reply	other threads:[~2015-08-29 17:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-29  9:07 [PATCH RFC V3 0/2] Optimize the snmp stat aggregation for large cpus Raghavendra K T
2015-08-29  9:07 ` [PATCH RFC V3 1/2] net: Introduce helper functions to get the per cpu data Raghavendra K T
2015-08-29  9:07 ` [PATCH RFC V3 2/2] net: Optimize snmp stat aggregation by walking all the percpu data at once Raghavendra K T
2015-08-29 14:32   ` Eric Dumazet
2015-08-29 15:21     ` Joe Perches
2015-08-29 17:25       ` Raghavendra K T [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55E1EB14.5040205@linux.vnet.ibm.com \
    --to=raghavendra.kt@linux.vnet.ibm.com \
    --cc=anton@au1.ibm.com \
    --cc=azhou@nicira.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=hannes@stressinduktion.org \
    --cc=ipm@chirality.org.uk \
    --cc=jiri@resnulli.us \
    --cc=jmorris@namei.org \
    --cc=joe@perches.com \
    --cc=kaber@trash.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nacc@linux.vnet.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=serge.hallyn@canonical.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=tom@herbertland.com \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).