Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1931960rdb; Mon, 9 Oct 2023 07:27:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8pzLrwKSA/vhEwt5vJNev8JKKU38FcbcyQ95owr70SpFIZdWBapTF5Y5m4t1pCKhNqPs0 X-Received: by 2002:a17:903:24c:b0:1c7:4f87:3dbe with SMTP id j12-20020a170903024c00b001c74f873dbemr15162666plh.31.1696861662434; Mon, 09 Oct 2023 07:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696861662; cv=none; d=google.com; s=arc-20160816; b=UI/vv/WLR1xG/DCpHJklQPo0ZgQdUe14ctoA1eiR7KFmbZ4648KW/otr2OGgREKwps 2zzAg6uqUBuuiY16239Wlabd1Ou5dfBXuvFqFZK8I4QG3u5uYt+9SjmfhV/XrcZPtHu6 cmfzYkpNOcH3VhJiZnqODegkqALjpMCHUodUvmDDbqUxdEeD2jvpkgpiArmz3aUvYrYW vWDLTh642xgTtf0Xh/LTtVtCKCRM7FvyOpX6k4YpHmciqb4hv+GHnimK68pZCN2vzkFf e+xshz7DqeiRpxDcFV/dMI9Dri8J6nIuLaq8v+jJE7wy49Aqq3S8IIb1r3c1RAkbVqX4 FGbQ== 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; bh=5h7jhp/8wFnlswKTG+NksRpGPKQutV9sqb06rLS1LU4=; fh=f0NPFS4vGlGA2yFRnoye3v0QCMi4bliKhI7l4nthOU8=; b=Gtc6VF9ffMnIQHtEyoVyy1tQHo5+J/Q69wAoI82n/xyGRyAqUGyL/HrVE4Qk/lL8eO VWYyaDoXGQZR4uPJT4s4KCtVRYy+vP683K+J7DcUdawE3tGd1Hg1+N31f+l0c+DyM634 TfKUMLZPiaEZSczNvjfrImm8TzsbinLEZE/Q0/ZoLrOZ8DomUEjxgNXkFxfjoUWwmrG2 x8f4WGlTlDeqd5/jbo7ecq92J/e7VdukK6V9TwHZy4vIBOc6Vm0RNkB5KhN8m/MNaU0l kEDSDRynw7yalol2VPP5ttMiGEtbQTauocrE+420llL+R9LK7R4cIgT7Gmh+hJWaRCGr dfww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id g18-20020a170902d1d200b001b9da7af2c0si9371597plb.214.2023.10.09.07.27.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 07:27:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 6AEAD801CEDE; Mon, 9 Oct 2023 07:27:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377018AbjJIO1V (ORCPT + 99 others); Mon, 9 Oct 2023 10:27:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376996AbjJIO1T (ORCPT ); Mon, 9 Oct 2023 10:27:19 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CDE3AB for ; Mon, 9 Oct 2023 07:27:18 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66577C433C7; Mon, 9 Oct 2023 14:27:16 +0000 (UTC) Date: Mon, 9 Oct 2023 10:28:33 -0400 From: Steven Rostedt To: Yajun Deng Cc: Eric Dumazet , mhiramat@kernel.org, dennis@kernel.org, tj@kernel.org, cl@linux.com, mark.rutland@arm.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Alexander Lobakin , linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH net-next v7] net/core: Introduce netdev_core_stats_inc() Message-ID: <20231009102833.1b0d35e3@gandalf.local.home> In-Reply-To: <078f662d-a73f-766b-3a07-c82cd37026c5@linux.dev> References: <20231007050621.1706331-1-yajun.deng@linux.dev> <9f4fb613-d63f-9b86-fe92-11bf4dfb7275@linux.dev> <4a747fda-2bb9-4231-66d6-31306184eec2@linux.dev> <814b5598-5284-9558-8f56-12a6f7a67187@linux.dev> <508b33f7-3dc0-4536-21f6-4a5e7ade2b5c@linux.dev> <296ca17d-cff0-2d19-f620-eedab004ddde@linux.dev> <68eb65c5-1870-0776-0878-694a8b002a6d@linux.dev> <078f662d-a73f-766b-3a07-c82cd37026c5@linux.dev> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Mon, 09 Oct 2023 07:27:40 -0700 (PDT) X-Spam-Level: ** On Mon, 9 Oct 2023 18:58:27 +0800 Yajun Deng wrote: > > C compiler decides to inline or not, depending on various factors. > > > > The most efficient (and small) code is generated by this_cpu_inc() > > version, allowing the compiler to inline it. > > > > If you copy/paste this_cpu_inc() twenty times, then the compiler > > would not inline the function anymore. Yes, if you want something to be visible by ftrace, it must not be inlined (as inlined functions are not function calls by definition). And as Eric stated, the compiler is perfectly allowed to inline something if it believes it will be more efficient. i.e. There may be code around the function call that could be more efficient if it wasn't change to parameters. If you want to make sure a function stays out of line, you must explicitly tell the compiler you want the function not to ever be inlined (hence the "noinline" attribute). > > > Got it. Thank you. Great. -- Steve