Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp913654lqb; Fri, 24 May 2024 19:41:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVMmwH/kx9cwF+LwwulX5UIrJpGN6nGzfKYmEWSDoh00nX1d7YpUykcRh7MYUNPodeQdsVfpllB5CT9iy9rpcmbeJVQpiHegs8IQb2pdQ== X-Google-Smtp-Source: AGHT+IHIVTD7ugnRBZmIMEKcvIBMoaEB6xlr8oZXG5anbO0KHsverxGGCH0R1lRb8ivT1mmLIrds X-Received: by 2002:a05:6a20:748b:b0:1a9:6c18:7e96 with SMTP id adf61e73a8af0-1b212d0a7c9mr4902990637.19.1716604904294; Fri, 24 May 2024 19:41:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716604904; cv=pass; d=google.com; s=arc-20160816; b=uE2fzGONDICtbw1vRXZWvpwft1e4Tbl+Bptf002fXsEU3QAe+MygIR+FhBT7YKJg3y kuG7pLVRdAOphzTVv5VskQpptxIkjWLKxVs+P4CdxmoDhlDGcIc73C4x+dyPiTY/xrgj 9DQBBAIfqYMb/GKcvy5d6al6RpWgepgnOb5YXpZj4siue/QnJjoOOZXvH8DOnQHnrJAL AIOpefd2oZ5hSYa7bNjBGXiOZ4+EY5ynP28uboSDdA/w0NpyYsDxluGjOK6l4DPeZ2l4 Fh6U2dbXqgarcyPEQyxhD4fc44s6GLEf/FPNaUYG5UYFb3l+2zizJDujD+qMyVuOw+TM Kxqw== 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=xWwvwCGYnVhPsnQ06rCoNqxSdLFISWOigqyaRRzbqgg=; fh=YfcaVrAzBpSwi8dOlqHV4K1os6qdULs4cyXFG/DyLfE=; b=OeO8RN6nKjBadKESN/zba0zM5c3QZm+lZeXpd+VLa/JsXYHIfzBVI3RIOLn2TS1l5K nKoTbGw+ndnoWxUcT9KAcZUV/aj/RFwaflCBaGlvgvICSzVmlrKlPDA31MrHF441pS/C kt68kYRSQCpjqlOiLGdehEbwwqR1frwcCX0QO/RcRrZRvHofDJDKVlzH1ec+ZrRjAIY+ l+jbwSoyWXLEx/IuAjMfxbo0z+mcek5SSM3B6wWkWzrhYganlEWQB6vyZUo2SFcKDGNa Jfd2zE3+yPyIUwVXkXaz89T+ao/I4qeK1aBtI7fk118EKUyNpsihRCLn/afYorWU0R5g XQ3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-189260-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189260-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c7856d1si23350925ad.128.2024.05.24.19.41.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 19:41:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189260-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-189260-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189260-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 6D3D6283317 for ; Sat, 25 May 2024 02:41:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 67B6012BE86; Sat, 25 May 2024 02:37:01 +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 06A2C42AAE; Sat, 25 May 2024 02:36:56 +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=1716604616; cv=none; b=kaSM7gZYXAfoPsRto17tzxlP4i3vam/IqGHVCfxmCLBGTHnFJqdo35wBzFM+fSvxPLKUdbvyKOYQBnjPmo/nROgvluoqCREDM+PXOkf7RHjiuAdCTNPoSWekfF3CPZFWzd7bg/US90HGCY4VmMsmIZUNtG1BBpaqsFLsb2gVtCw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716604616; c=relaxed/simple; bh=8c3eUfuTpuKiHlzEemN4Bi/eGFOd/Gj+lm0eh9S4nRQ=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=sJf8xJ4tERb6GKQUP4m56+8E0Pvr/4dCEmYPpJfRMK/VWnAqreucwVPL9/QN233rT74WkS+nn3uWzaiHQNjNO70mNwH5T1jbouBTkJKj6/FCbhTcyw6t/PJZuEgVux7Ysb4IfRXZwsZAQhiYpJehqz+TAjhws6Ir+MszHUFW3JU= 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 B94BCC2BBFC; Sat, 25 May 2024 02:36:55 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sAhI0-00000007DR5-1YQz; Fri, 24 May 2024 22:37:44 -0400 Message-ID: <20240525023744.231570357@goodmis.org> User-Agent: quilt/0.68 Date: Fri, 24 May 2024 22:37:11 -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 19/20] function_graph: Use for_each_set_bit() in __ftrace_return_to_handler() References: <20240525023652.903909489@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) --- 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 4d503b3e45ad..5e8e13ffcfb6 100644 --- a/kernel/trace/fgraph.c +++ b/kernel/trace/fgraph.c @@ -827,11 +827,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