Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1168554lqj; Mon, 3 Jun 2024 12:15:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWnTXrR0E3QsFGBnT27cy9xrXJ0kHKChdCkhsRpuiuKA6+8PBmVbCtg+ZkbMX3Daemw1H8NMSRrMdklO5Jl6sKXOfNUj1mtdHXMyxleUQ== X-Google-Smtp-Source: AGHT+IEXu7DQCjgFP6XP6r9QxfoylesQ7PR7HB7YqfUm43PHaP9eW1TfWYHtYhcD9zt6d8I8tcBk X-Received: by 2002:a05:6e02:f92:b0:374:9957:7333 with SMTP id e9e14a558f8ab-37499577499mr44620855ab.8.1717442108902; Mon, 03 Jun 2024 12:15:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717442108; cv=pass; d=google.com; s=arc-20160816; b=PknfCeqL06W/ORjmU6VpZ93cAXwKKwXGrJvp4hZeCPSVZaFehI/OhDY85YfcZWl0sT SZf0dLJhxs6jmyM2fFFHIt6fmAkMDHjZm9Zv9ZlhtLBsn/Tu6/8115TpV6m6l/CZfGqa q1Xl1loZr5jIWxplq1vm/lDGHgnbbwYeVZVi9t0CZTvTeAPSGv2NiYamo4xvTApzSTvB po7FZ+7SuIxi2QUUE+mJKKE/wmUHHx21ctCnRs1bHqjYAp6nlk6/WAMhrEPW6n4sZmVb m2RBOc+qlLVFVJtcTIZcDlqDkNHW2OMs5IPieeTtaaJ0AilS//sZfpUyfzmqbrsrVOeh bKbA== 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=xL/jTFbds5Z/A4zFUxHEZ9ZlAH0LCe8+uujbPPXLOB0=; fh=YfcaVrAzBpSwi8dOlqHV4K1os6qdULs4cyXFG/DyLfE=; b=Xr8xLO9XI53UsjogHSlnGhHms5eaYg7nyKlbkGlskefUcKTGoIsXwYJfKXGqu7AO1E coLvbplCTxMixKUJ4CdbkfajoudZJqliiXhGwdv7cDQhbqLYPnrxoY2ZRwb3uYq+WLuo QeAqRcJ+DXx6gvnWagHFVYiab0ntA/PyucQ/im5hVMybE3pBrC8w/gH11CdkYNxLymjO iW2WhQboy3Mu8JDAIO2Fh7DOWKI9CnDKZBhPQyOAYUiw9ATHoxDu++uKd06MXZPq1z3H LvJotktdOw97d7RmdyPFGwis2WVPwQGcGeVCiWLs7ZhRamsJiAd9f9+2dAFZDRF2wvCw HHqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-199615-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199615-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 41be03b00d2f7-6ce6056ce96si1868546a12.210.2024.06.03.12.15.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 12:15:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199615-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-199615-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199615-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 3228F28B176 for ; Mon, 3 Jun 2024 19:12:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E0C61411C1; Mon, 3 Jun 2024 19:07:18 +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 ADDD113CFA4; Mon, 3 Jun 2024 19:07:13 +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=1717441633; cv=none; b=o7WLjfFgrQcRri8qtdR72REC1jvooz3z+9zzw6H8GhY+XvUO3FR2nn0Xc5icV26IjVaVyqpEmd1ZOGhR/rbQ9IcNnl85GyWvVR4naUQjcORrdczB2IZkKI//VBX2B8RCwwmiEcg1OQ/RU7MiahARPtZcg6WI944Xx1eNMKLZNHk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717441633; c=relaxed/simple; bh=HaOqVX9Zfq8EcxlqcgeTv6riQSn0DAcVMNqbadp2eeM=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=rKg9hctxxEGKAmGRDo0lGA3owFq4gikhwiEJ1eB0EuCJvsLi3+nnRJxJfHkbPd2kkEi8TIv4ZjgnS8Z3iPvHWX/sVydy864XjjhQ7SDNIRA+7ECjZHUZRvzni+ivAfuhdNSwgqvTnwnZy5GdsJ6+LaB4SSV5NOHxPgrE4IgT5jE= 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 8B5B8C4AF0D; Mon, 3 Jun 2024 19:07:13 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sED2e-00000009Twx-2Rbe; Mon, 03 Jun 2024 15:08:24 -0400 Message-ID: <20240603190824.447448026@goodmis.org> User-Agent: quilt/0.68 Date: Mon, 03 Jun 2024 15:07:26 -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 v3 22/27] function_graph: Use for_each_set_bit() in __ftrace_return_to_handler() References: <20240603190704.663840775@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. 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