Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3091394rdb; Wed, 13 Sep 2023 01:27:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtMDPPbdSRT1RZ/0ihkFa0tEAyf42eEWMUp3mnojwOvoyJ021XbDRVLCWt1HHTSAYYbpMh X-Received: by 2002:a17:90a:744f:b0:26d:2635:5a7c with SMTP id o15-20020a17090a744f00b0026d26355a7cmr1443039pjk.2.1694593637497; Wed, 13 Sep 2023 01:27:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694593637; cv=none; d=google.com; s=arc-20160816; b=tTbaf7aNC9+1Eokggs3pBXKSpmUhMBnreRIzoXU39OjhbfqTnA9ckBErPzQW+e1ph6 U8TZk8y76WyRk/RmU7tmFGIUcgkl34tb5bvWnesPShMaLN8k9mF2O7LNZZItaRvgJ68b Wk0bhuO8hKrGlLyNoImMTc94ld2vzOobot4jYGUU2kn/OW26p1wrquziDv7v1Q2CzOw+ dMD7IZONkkklyvyS3yDgBGZ1rIp8OyQv3kCk1qK3X31zl6F8BHPrmu5pd9hmAGZUDVpB axg220oJzPzfbMuYZvk3QQlUcX2D3qWulHlvwjrZAzUh7UYpc3EVzIozttgZo5+RjaAt BCMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=Z8wsciRXxC4ZkB77LojSqC5l3QSYtqdqHx5TpDtcjbg=; fh=40OSXvgRe3/3cBFDSxGp2OKclISTx1lESjicKnopFl0=; b=wPpE58dUJ1qHfEuGa6bcaXq1yx5esCKvK+IT5XkifShQ36aB5nekVcZ7COi8BNQflM IS5QLBYCe4PxFW27aYc0S51EtTdDpqWJ38Xh53AmmKdL/klfdnQb2zMJgCuJaiYWc11B DORnBNsB8Y74WOuveLXUdyP6P/+pXmar7Qjw0wj2KcQwdphVwSR8QNtPIIoYJm/XPSpi YRx5lR7HVBdpIZaQqsHcXzJcCxqUKPHd6PxB3m/I6rlfG+RTmCofTEFR1w9W9J4FJAa2 l/R5C879dyDZsGYDsJpmmJPaZ19Al+SA6LQ2Y/QazHtUuotPN8UCRmZTSV++rd/nyzs6 i+Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=luS8ZCII; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id np9-20020a17090b4c4900b00273fde2471esi1199435pjb.88.2023.09.13.01.27.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 01:27:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=luS8ZCII; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id ACF368184E3A; Tue, 12 Sep 2023 19:20:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236673AbjIMCUs (ORCPT + 99 others); Tue, 12 Sep 2023 22:20:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbjIMCUr (ORCPT ); Tue, 12 Sep 2023 22:20:47 -0400 Received: from out-226.mta1.migadu.com (out-226.mta1.migadu.com [95.215.58.226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C018170A for ; Tue, 12 Sep 2023 19:20:43 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1694571641; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z8wsciRXxC4ZkB77LojSqC5l3QSYtqdqHx5TpDtcjbg=; b=luS8ZCIIDr1Q7HVRMIMRCuClOJm+JpXL7F3OdTGcEpMru6cqNBfyvjBF2mai+fCnUGUo1u +i1RAmE3gJKihn6E9zU7Nn60IWl+2jcAI+SSj2fEE4+TgGgZPYiXHbKGgIrurlQyQEU7GX fEoxe6HEPQ5Ff6NT+5xhxsmYKWcBlCk= Date: Wed, 13 Sep 2023 10:20:32 +0800 MIME-Version: 1.0 Subject: Re: [PATCH] net/core: Export dev_core_stats_rx_dropped_inc sets Content-Language: en-US To: Eric Dumazet , Alexander Lobakin Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230911082016.3694700-1-yajun.deng@linux.dev> <39c906f6-910d-01c7-404a-8fe6a161ef2e@intel.com> <8bc6c1cd-50bb-44ef-5979-3bb50a70afcb@intel.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yajun Deng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 12 Sep 2023 19:20:46 -0700 (PDT) On 2023/9/13 02:05, Eric Dumazet wrote: > On Tue, Sep 12, 2023 at 8:03 PM Eric Dumazet wrote: > >> Sure, this was what was suggested (perhaps not _very_ precisely, but >> the general idea was pretty clear). >> v2 seems ok, right ? >> >> It seems we are all on the same page. >> >> +static __cold struct net_device_core_stats __percpu >> *dev_core_stats(struct net_device *dev) >> +{ >> + /* This READ_ONCE() pairs with the write in netdev_core_stats_alloc() */ >> + struct net_device_core_stats __percpu *p = READ_ONCE(dev->core_stats); >> + >> + if (likely(p)) >> + return p; >> + >> + return netdev_core_stats_alloc(dev); >> +} >> + >> +#define DEV_CORE_STATS_INC(FIELD) \ >> +void dev_core_stats_##FIELD##_inc(struct net_device *dev) \ >> +{ \ >> + struct net_device_core_stats __percpu *p; \ >> + \ >> + p = dev_core_stats(dev); \ >> + if (p) \ >> + this_cpu_inc(p->FIELD); \ >> +} \ >> +EXPORT_SYMBOL(dev_core_stats_##FIELD##_inc) > Oh well, I just read the patch, and it seems wrong indeed. > > netdev_core_stats_alloc() is the one that can be cold. Okay, I would add __cold to netdev_core_stats_alloc() in v3. Olek suggest that define a new dev_core_stats_inc() function. I hope to see the suggestion in another reply.