Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3591149pxp; Tue, 8 Mar 2022 18:16:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJztMTTJbczce9jNlqaeZwFQL5NcWZKPEhI/I6KpQym4/1vuzwcLCZA4gOws/Grwlz9AKVG7 X-Received: by 2002:a17:903:22c7:b0:151:a594:bb85 with SMTP id y7-20020a17090322c700b00151a594bb85mr20599189plg.107.1646792164022; Tue, 08 Mar 2022 18:16:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646792164; cv=none; d=google.com; s=arc-20160816; b=UB8RucYed6H8s7UfichuF8c/zAkn2Dej8QwMmD+3BBYmxudnRJSE+iAJXLTMimT3p2 3Icbq3e8dsNuT69rWb/F3qSK0gdQuaIaqKp8v5HwiimGb6KysBjlhX6kS8QGt/1KYbK/ bSleZQDb3vDtXDpyyOB1ni9xjo/fvEldYQak2fuPlFFzPvLgbcrc/Ma2bnaVnuPcmoIE KT2kZ2aJsmBpp73IkolKqQodD0LuN8ddRA9sQ2kRqyZ0yn0T939rxjmL9wWVaSZcPIUn vykHDKe3T6M2wFmMuXNpAtNEpnxFlOWMoc5vb5mSKHzz2B+RvgOrtDw6T8jq+5ArXKWx TJbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=0K0cSaBXEAgPhsrLTtS2ebACU2R59YxN4MI2GWU4pSs=; b=yQXPcdxR37/sPz6SCFc7vXVpq4Afqf0lqScZiLz6k47rm9ip6YohmXZ9yXnGzbbkWy +aFB+oHVwp8DhGfUit1Yujf92UCVVWfslg4wb9+u3UFBxsNX/volqhdiQrMCSTn5UdmL BarMccdi3UJ25eb0QbbFM8x++EFWDP9gM2SReWa7tyZwt2en19DKQszBgY5Fb1+/OVOh 7C3G+819XVMdqrZaoo3flD9C1KwyStTirUsz2KKfJ7ohf+fEKdd0SIjFBiO42kUWNxzg KWSMtuMjsUXhEn+mBr5UaXfYKhRkNHdMTgxMrFB4XavZkPvGOe6SnRYvMl9C6TdvbpS8 euDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ATv15O2q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b11-20020a170902bd4b00b001516f2cc30esi563640plx.497.2022.03.08.18.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 18:16:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ATv15O2q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7680B17AEE3; Tue, 8 Mar 2022 17:09:47 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230503AbiCIBJo (ORCPT + 99 others); Tue, 8 Mar 2022 20:09:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230523AbiCIBJd (ORCPT ); Tue, 8 Mar 2022 20:09:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7950614CC8E; Tue, 8 Mar 2022 16:51:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 133BB6131F; Wed, 9 Mar 2022 00:28:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2F04C340EB; Wed, 9 Mar 2022 00:28:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646785683; bh=7ts5yK9dKmm0RkdfCHFJSloLAhqqU7Px2Yg0dWLSehQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ATv15O2qyedqsb3YuOb+pBi9rlcdHwsQyp5MYExREL36OJLhpjs0c/jingYsBhxOp LJE+8VdSlqsVvLTNVhILrTD80c0ttZ+b5qUAAQkqoYrO5TQ7achOli2LFW0qh2BfQo zjfSikWfy042N+t+s2LLzcWQ3wkENXY2gRPGmnj6yLTueKYz3ahBZxAWgfdLsvIXad t7zUVoK5dFhH05qJeyOmUQbXdeJBedmg3ZIubEWMYc9fyuv0x9ha4JySgJglhX7ahj W4VZeGq92x4nI014iRF6vWc1Aif/RNO4npy0YZYQpy1u0U8lde62YU46dzALdMvc6l MqQqIJ43/ygvw== Date: Tue, 8 Mar 2022 16:28:02 -0800 From: Jakub Kicinski To: Eric Dumazet Cc: David Ahern , Jeffrey Ji , "David S . Miller" , Brian Vazquez , Hideaki YOSHIFUJI , Antoine Tenart , Sebastian Andrzej Siewior , Alexander Lobakin , Kumar Kartikeya Dwivedi , Arnd Bergmann , netdev , LKML , jeffreyji Subject: Re: [PATCH v3 net-next] net-core: add rx_otherhost_dropped counter Message-ID: <20220308162802.0ecec1bf@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: References: <20220308212531.752215-1-jeffreyjilinux@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 8 Mar 2022 15:18:25 -0800 Eric Dumazet wrote: > > that's an expensive packet counter for a common path (e.g., hosting > > environments). > > This was the reason for the initial patch, using SNMP stat, being per cpu. > > Adding per-device per-cpu data for this counter will increase cost of > netdevice dismantle phase, > and increase time for ndo_get_stats64(), especially on hosts with 256 > or 512 cpus. Two ways to solve this: - make dev->pcpu_refcnt point to a structure which holds both refcnt and whatever stats - combine these stats into lstats, assuming the netdevs we care about spawning / destroying fast are sw devices anyway; struct rtnl_link_ops can indicate to the core if the driver wants lstats (or just put how many bytes it wants), otherwise we'd only allocate enough mem for core's stats Option three - both.