From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8577C433EF for ; Thu, 10 Feb 2022 16:54:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B7F36B0073; Thu, 10 Feb 2022 11:54:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 366696B0074; Thu, 10 Feb 2022 11:54:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 255C76B0075; Thu, 10 Feb 2022 11:54:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 1335A6B0073 for ; Thu, 10 Feb 2022 11:54:30 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A5DF5231A6 for ; Thu, 10 Feb 2022 16:54:29 +0000 (UTC) X-FDA: 79127468658.02.F6D8D53 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf06.hostedemail.com (Postfix) with ESMTP id 512EF180007 for ; Thu, 10 Feb 2022 16:54:28 +0000 (UTC) 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 ams.source.kernel.org (Postfix) with ESMTPS id 2E265B80837; Thu, 10 Feb 2022 16:54:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8802AC004E1; Thu, 10 Feb 2022 16:54:24 +0000 (UTC) Date: Thu, 10 Feb 2022 11:54:22 -0500 From: Steven Rostedt To: Christophe Leroy Cc: Ingo Molnar , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" Subject: Re: [PATCH] tracing: uninline trace_trigger_soft_disabled() Message-ID: <20220210115422.111755e3@gandalf.local.home> In-Reply-To: References: <38191e96ec6d331662ee7278e26edb79cdf95402.1644482771.git.christophe.leroy@csgroup.eu> <20220210092617.2bb40912@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf06.hostedemail.com: domain of "SRS0=5J3p=SZ=goodmis.org=rostedt@kernel.org" designates 145.40.68.75 as permitted sender) smtp.mailfrom="SRS0=5J3p=SZ=goodmis.org=rostedt@kernel.org" X-Stat-Signature: whejemx9m5dbojnd3jxw73qaxn659j4y X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 512EF180007 X-Rspam-User: X-HE-Tag: 1644512068-642517 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, 10 Feb 2022 15:05:51 +0000 Christophe Leroy wrote: > > Well, my first issue is that I get it duplicated 50 times because GCC > find it too big to get inlined. So it is a function call anyway. > > For instance, when building arch/powerpc/kernel/irq.o which -Winline, I get: > > ./include/linux/perf_event.h:1169:20: error: inlining failed in call to > 'perf_fetch_caller_regs': call is unlikely and code size would grow > [-Werror=inline] > ./include/linux/perf_event.h:1169:20: error: inlining failed in call to > 'perf_fetch_caller_regs': call is unlikely and code size would grow > [-Werror=inline] > ./include/linux/perf_event.h:1169:20: error: inlining failed in call to > 'perf_fetch_caller_regs': call is unlikely and code size would grow > [-Werror=inline] > ./include/linux/perf_event.h:1169:20: error: inlining failed in call to > 'perf_fetch_caller_regs': call is unlikely and code size would grow > [-Werror=inline] > ./include/linux/trace_events.h:712:1: error: inlining failed in call to > 'trace_trigger_soft_disabled': call is unlikely and code size would grow > [-Werror=inline] > ./include/linux/trace_events.h:712:1: error: inlining failed in call to > 'trace_trigger_soft_disabled': call is unlikely and code size would grow > [-Werror=inline] > ./include/linux/trace_events.h:712:1: error: inlining failed in call to > 'trace_trigger_soft_disabled': call is unlikely and code size would grow > [-Werror=inline] > ./include/linux/trace_events.h:712:1: error: inlining failed in call to > 'trace_trigger_soft_disabled': call is unlikely and code size would grow > [-Werror=inline] > > > > If having it a function call is really an issue, then it should be > __always_inline Yes you are correct. > > I will see the impact on size when we do so. > > > What is in the hot path really ? It is the entire function or only the > first test ? > > What about: > > static inline bool > trace_trigger_soft_disabled(struct trace_event_file *file) > { > unsigned long eflags = file->flags; > > if (!(eflags & EVENT_FILE_FL_TRIGGER_COND)) > return outlined_trace_trigger_soft_disabled(...); > return false; > } > > > Or is there more in the hot path ? Actually, the condition should be: if (!(eflags & EVENT_FILE_FL_TRIGGER_COND) && (eflags & (EVENT_FILE_FL_TRIGGER_MODE | EVENT_FILE_FL_SOFT_DISABLE | EVENT_FILE_FL_PID_FILTER)) { return outlined_trace_trigger_soft_disabled(...); } return false; As we only want to call the function when TRIGGER_COND is not set and one of those bits are. Because the most common case is !eflags, which your version would call the function every time. Maybe even switch the condition, to the most common case: if ((eflags & (EVENT_FILE_FL_TRIGGER_MODE | EVENT_FILE_FL_SOFT_DISABLE | EVENT_FILE_FL_PID_FILTER) && !(eflags & EVENT_FILE_FL_TRIGGER_COND)) { Because if one of those bits are not set, no reason to look further. And the TRIGGER_COND being set is actually the unlikely case, so it should be checked last. Would that work for you? -- Steve