Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753340AbbH2PVc (ORCPT ); Sat, 29 Aug 2015 11:21:32 -0400 Received: from smtprelay0126.hostedemail.com ([216.40.44.126]:39718 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752966AbbH2PVa (ORCPT ); Sat, 29 Aug 2015 11:21:30 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2538:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3868:3870:3871:3872:3873:4321:4605:5007:6120:6261:6742:7875:7901:7904:8603:10004:10400:10848:11026:11232:11473:11658:11914:12438:12517:12519:12740:13069:13255:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: pan59_63e25245fa75c X-Filterd-Recvd-Size: 2676 Message-ID: <1440861684.3276.7.camel@perches.com> Subject: Re: [PATCH RFC V3 2/2] net: Optimize snmp stat aggregation by walking all the percpu data at once From: Joe Perches To: Eric Dumazet Cc: Raghavendra K T , 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 Date: Sat, 29 Aug 2015 08:21:24 -0700 In-Reply-To: <1440858726.8932.149.camel@edumazet-glaptop2.roam.corp.google.com> References: <1440839278-21928-1-git-send-email-raghavendra.kt@linux.vnet.ibm.com> <1440839278-21928-3-git-send-email-raghavendra.kt@linux.vnet.ibm.com> <1440858726.8932.149.camel@edumazet-glaptop2.roam.corp.google.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1411 Lines: 45 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/