Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752831AbbH2OcL (ORCPT ); Sat, 29 Aug 2015 10:32:11 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:36534 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752494AbbH2OcJ (ORCPT ); Sat, 29 Aug 2015 10:32:09 -0400 Message-ID: <1440858726.8932.149.camel@edumazet-glaptop2.roam.corp.google.com> Subject: Re: [PATCH RFC V3 2/2] net: Optimize snmp stat aggregation by walking all the percpu data at once From: Eric Dumazet To: Raghavendra K T Cc: 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, joe@perches.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 07:32:06 -0700 In-Reply-To: <1440839278-21928-3-git-send-email-raghavendra.kt@linux.vnet.ibm.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> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 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: 1001 Lines: 33 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. -- 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/