Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp177876lqb; Tue, 4 Jun 2024 08:18:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXat2rxO1vQBotFaZAEO1TnxK6iovtzMy4Qh3+WNB9w2DBdcz/qXN5Yw/JN6dZr7Wti9z7KEc0hDXpiQ7B+p1/V+BcuqdEFh+ESCgRxgg== X-Google-Smtp-Source: AGHT+IEye6WQrdDf6JSOCs3YT7PcHX87M/+YwLxVa65Pxahzl1Q9aWlBIWN2PRpfNPTMswSBgv07 X-Received: by 2002:a05:6a21:339c:b0:1af:af89:ed71 with SMTP id adf61e73a8af0-1b26f117905mr13617047637.19.1717514292503; Tue, 04 Jun 2024 08:18:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717514292; cv=pass; d=google.com; s=arc-20160816; b=VWNH3TVQaJF3HXAhkPHvfMR6SaPHvaWjRl5JmtBcYllrpT0eh7kSDyXsJeafebLT99 slZyNFfywelbSQ5W0TqFGsoO/v5ZXcrEwjuJ9mIxcYVyJjUPj7x+p0r5ZKn1KhFW6yvU azm7guvFH57tv4YtANt3ox9/xRUDILib/mAGR6tTK5F15SmhK9dTOqAHIlH3DmRBonF2 vGIAFMjME3wSHvXVg7Vr7e7d1M8eGAz7Jz46p8AESqShwgxxNGLge/ckcSvw7QiMis/J M4DS3cR0IFYpErPSYA5ZEJvhL00sugYGmBf3cOSj4eYig2C+OrsIZf/Vzuxvk4RPFJmm IO/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=B4NxG7R2p0r4TMDl78wbjxM5nvT0T3GjUjZrANlMmJg=; fh=/wy5e/q+z2qlOMkv0QH/u80KV4ZXPtz68q6c1OyjqGY=; b=Fl6OmrnCEdSITVsTQ8FdU3GZ+773fp26CfFP6crD8LgVcrZFEZ5xm5GGiGPPGdMmrT w/2OFprs8HUbPF4sq62Nh0/63fn+NKwrCLZZred34K+SnC933wXuTeB+hdohnB5cACKb jyjCCwJzxKZM5UvGjvDjSqGX8jdtgYJHYOCJZ/TcjrVsz3QHH/Y3ALP/G2ScMfHA5Cz5 K+bx6jyu82KwTrH7/ZbCWuQUDKtO7vtJJEUTLrhMA0NaaSoiuikQleG8DLbjJPxQC6SZ ZYjlu7Xuokwml5I6q+kpDhO+LI149jj+U3EyBnX0GyMV0PtFwXVOdTXByynWg0YzuCGL USLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-200883-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200883-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35d973c94si8359952a12.886.2024.06.04.08.18.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 08:18:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200883-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-200883-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200883-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 793A0B288ED for ; Tue, 4 Jun 2024 14:49:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A09B14EC6A; Tue, 4 Jun 2024 14:42:25 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D71F14A096; Tue, 4 Jun 2024 14:42:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717512138; cv=none; b=Eptt4UD/3JD0af5pIbHEcpraagddzwbwfunwR26yWATB3jhCH/6qtGFJQ5c68KmS+OGk2aFKjogvtYyeLvhuvnDG+7eXBUnynISIXfObUty9pDNB6mnIb3H5F7uXW7wJRYJkTOeDMU9pMGavh/j0urRDXnoC2nle17v3dg/GlIY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717512138; c=relaxed/simple; bh=tawZq6mZMuTEGrptN7vmtsKrb6RsFVEDkjhbdYbPgqc=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=QwFdypVtfESp1t5ZRjPQcA3rMaAHt4YFYfNHTIqhygeKECd17aU4GvogqpZjHdjgS52HPUBLhLZkDy+XZMflr6alg45NoTG+NtX1W21rEWI2r/Jxwe0YULd1USWMvLkIrokqoLv4tC4gE2RnA8dm+9LeycUvDwy+aHE16oh8L1E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75A14C2BBFC; Tue, 4 Jun 2024 14:42:18 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sEVMf-00000000Z3z-2kN0; Tue, 04 Jun 2024 10:42:17 -0400 Message-ID: <20240604144217.514766673@goodmis.org> User-Agent: quilt/0.68 Date: Tue, 04 Jun 2024 10:41:25 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Alexei Starovoitov , Florent Revest , Martin KaFai Lau , bpf , Sven Schnelle , Alexei Starovoitov , Jiri Olsa , Arnaldo Carvalho de Melo , Daniel Borkmann , Alan Maguire , Peter Zijlstra , Thomas Gleixner , Guo Ren Subject: [for-next][PATCH 22/27] function_graph: Use for_each_set_bit() in __ftrace_return_to_handler() References: <20240604144103.293353991@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 From: "Steven Rostedt (Google)" Instead of iterating through the entire fgraph_array[] and seeing if one of the bitmap bits are set to know to call the array's retfunc() function, use for_each_set_bit() on the bitmap itself. This will only iterate for the number of set bits. Link: https://lore.kernel.org/linux-trace-kernel/20240603190824.447448026@goodmis.org Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Andrew Morton Cc: Alexei Starovoitov Cc: Florent Revest Cc: Martin KaFai Lau Cc: bpf Cc: Sven Schnelle Cc: Alexei Starovoitov Cc: Jiri Olsa Cc: Arnaldo Carvalho de Melo Cc: Daniel Borkmann Cc: Alan Maguire Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Guo Ren Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- kernel/trace/fgraph.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c index f207b7ae5f46..0827b67f746d 100644 --- a/kernel/trace/fgraph.c +++ b/kernel/trace/fgraph.c @@ -783,11 +783,10 @@ static unsigned long __ftrace_return_to_handler(struct fgraph_ret_regs *ret_regs #endif bitmap = get_bitmap_bits(current, offset); - for (i = 0; i < FGRAPH_ARRAY_SIZE; i++) { + + for_each_set_bit(i, &bitmap, sizeof(bitmap) * BITS_PER_BYTE) { struct fgraph_ops *gops = fgraph_array[i]; - if (!(bitmap & BIT(i))) - continue; if (gops == &fgraph_stub) continue; -- 2.43.0