Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp287611lqj; Sat, 1 Jun 2024 20:52:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYzy0IefW+hoAd0/WOI2VMXn+ocOiKvSRucp2sThRWEheXgOEpAt92v4mdPvdN1vDFT7fa8aou5fs7cHt5wigFPamYImL1lRPLWYzBvg== X-Google-Smtp-Source: AGHT+IGDwxRHa/ve4jfyqJ1D5JtAoCJx5o4dpwsvds7pg6w4vWirBDPD/HXNzjjnwN1uPCe35sUs X-Received: by 2002:a05:6a20:2455:b0:1b1:d402:a93f with SMTP id adf61e73a8af0-1b26f185b65mr6754614637.37.1717300344127; Sat, 01 Jun 2024 20:52:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717300344; cv=pass; d=google.com; s=arc-20160816; b=VzfqV75667LlNOOGVvHRWEuAkb6SYosyaYEriVZzF4f3QM2itpehqMN8mx1bdpq9GB VcsGdpdnKo5u7SIrJhroVQbt19pNzG0Yg/UlzUyX2dN3N6EuM5/O765X4ZDmMjryXU99 EekIJkRVUqHSpxolIndPDBwaQTZRVNLySFcoZtoHRLDB8D0D9jRan32c6GYSBetQjwjS gYT8rnZp1oJqQaPRBqc9b2zAedARUIgyLrF/Pv3cqJH+E0khdI4ZMA6HikmILxc6PNQm I2zDh6TqZ+K8dfrhL9wXJ4mjTNyDDHMUth8qKMdX0REcWZuwAUFivK+U5lN3a3SfdI+9 hFMA== 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=XPEzMJ+0VarKNteX/DHpNhds9RAScZHUuNn32t3Y+TU=; fh=YfcaVrAzBpSwi8dOlqHV4K1os6qdULs4cyXFG/DyLfE=; b=z1u8zHaZtjW8/MB46YsG0zp3qWHbwZdq/VibXvW1zD4wsywjhc1rMv63WZeya/A4ib ZaqWlfMWX6k2coo0byT/blH+w7Bf/p1VwYUNcRskB7r/FAF+vWfcPyGtebx7yqj9Qq4M 4xXFFkd0RR8Ob61Uv9I7jDUSTXytdHacOcenaoVoSRkjMD9kVxDosVz9w28T0yG6vGnl ekkIYtTYTcQ+0mmuy/PgZAyZc6twyT4M0Sq1Zf8O3cDxa3F1ZPEDIkzkXI1mWgd35tSx 7AiJ0Dgz1yF1Mej0R1h2/LevcQyX88RQIMf8eXrzNc1NEkzJr8vAJpLLm8RIOUG7arAo ZDRw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-198105-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198105-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f632401b21si42535855ad.486.2024.06.01.20.52.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 20:52:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198105-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-198105-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198105-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C083928313F for ; Sun, 2 Jun 2024 03:42:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9CA6C77118; Sun, 2 Jun 2024 03:37:32 +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 E30BE3CF7E; Sun, 2 Jun 2024 03:37:27 +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=1717299447; cv=none; b=BXw0oiZTPxtl5Tb4aMQVkvCbSY8SXz25pDg9cKnD6lo/AjlPz5bQHbR3Hh9nWPdQxwYPfN69NsB4FgwUrhYQC7P/fM+RBzSWc+Gfxvm0NIr6VIlASP5OmCHGPEHhzLTOBLMNuDIb6d4OpfriDG0G6MT5FcJOLI7Q1E2qNLUk4ww= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717299447; c=relaxed/simple; bh=Qstcw+QWGH6Zf1yKRINHtHvTAk/4oegqRJJtV80eclA=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=LPllK3RvEBsjsf/RZR0QQmKehTNJlbHPsXgDdXDdKeyB2xt0pn62l3CGbScle8umPh3ltY9bMaNbQYRylCZThf3kdGE/IAza4n1YD1VSZHTvit+Mf0qvevoz2oevf/iVenLhlaVD2x93++y7RGfcFxuADJNJ/s99yVeyKCTnML8= 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 81790C4AF1A; Sun, 2 Jun 2024 03:37:27 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sDc3G-000000094Tw-3OZu; Sat, 01 Jun 2024 23:38:34 -0400 Message-ID: <20240602033834.670024223@goodmis.org> User-Agent: quilt/0.68 Date: Sat, 01 Jun 2024 23:38:06 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-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: [PATCH v2 22/27] function_graph: Use for_each_set_bit() in __ftrace_return_to_handler() References: <20240602033744.563858532@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. Signed-off-by: Steven Rostedt (Google) 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