Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1765736lqb; Sun, 26 May 2024 17:04:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVvSbxUUwryfwZR67Jz0kkvIO1OCt0CQkk+WYM1oD+d5s+nCH74RhDaBCRh4Nbta4oZL6wuYJbxxL2wV49atiqc89tmLL8mei1nG39BgA== X-Google-Smtp-Source: AGHT+IHzorr3HLXazfCAKShljD5WL66ENXt4KgJvIkDM+20ARVCYp7dZSg1g9IFPR3sYHC0k8Z7r X-Received: by 2002:a17:906:2789:b0:a59:9ad2:a7f8 with SMTP id a640c23a62f3a-a626511490fmr519160866b.72.1716768289570; Sun, 26 May 2024 17:04:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716768289; cv=pass; d=google.com; s=arc-20160816; b=oEeHRXAw8TOjxdNjgZU8f/T/861v2P9wjyKOhnfgpJVXFOSc8IImtOOcvJpVrQGIFx baJ1qwW88V3JLj7cYAxbOQeXHkbIFEpILaBkQS342VkGaqh7NMsulnvDLTslIsk+7Qi9 jwfgEgKbyTVG5fe+td8j9gA5K44sTiBgFqLbhR9CjTgaT6z/RtsFIK8rhU0YeHHv8jwN dLOV5OqVL7TOf5Qe0QgE+asGSN6CHBlfQm2dmubPEt2Lr7eR9gTTOdawiOk7LWfIclhB TYFgiNb/We06+0V0yRIzb3EO23oF1u/V35+FfDAFGHFgUK5+kLWAFZL84XmIFqOpFH3X i4uQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=no6qqXPIDu8MNuc1l4iUP4aXZNJli7h93qMuJeEKUQc=; fh=jPbTOLaFRquCWSHePkx5JyHgrJfqc0pfK3tHoljjLqk=; b=ACD5BGPA8k1MEZKxhkSKcIAzlgLpXy39ljRq0LzEjx+dAnJdR45G2n7XxrTxjkb2gM lfb6zcapM3SAQF4++Pluk4KVkXq3/KvqVi8hI3k9ehZREGQZr/vf+SpPOdqSF2vxvB2o Ii3jCZczJXdDLp4dJtTIz6C9pAC1A4G+aBscXGVS30+UvXPS59bMMhAjaY8Z6A4XxDm3 AgwvAAv6Za6bKHwTHNzc+LNbVFjA1tuBRTyE092nUwMW6aDThAyVCWwT2wg0YJ9TuUl9 Ohs7E+cTHDAXBgH5FtQqJgN3usUyBv0rwIPMRodNZ0aPyS71Dr1zvowBccK2NjqL+Y1C ujkQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XPHIv4TU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-189905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189905-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cc68f00si317410266b.688.2024.05.26.17.04.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 17:04:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XPHIv4TU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-189905-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189905-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4E3D61F217EF for ; Mon, 27 May 2024 00:04:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F36C665C; Mon, 27 May 2024 00:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XPHIv4TU" 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 21B94161; Mon, 27 May 2024 00:04:40 +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=1716768281; cv=none; b=JfLnv9pDaaC8echBKxcBAJyCvFJ2co7lXgXIt9LjNI48OPzLwzloV08Cb4k5QdteQdMSz24+QzQa/IM74XqHSN7iSS9rK/92cLSd23QmXj1Pmp7F30OWZKECR5HsFSk2UUF4iJUBkFPH6fkxXkI4t7suEtJD6h5hz31jAyOpIow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716768281; c=relaxed/simple; bh=PcmYPBGo2XhGqyaercyt+IZ2k2DlEHd7kUXcc3kQ2Eg=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=Na0WHFF7aW9Q4nVEU4fthGx/N5WKgbf2qLTvr8BZCTbUR4ZYBKK94wZofRm/DiaA9bXZKjLdG16kmIZLs8xIXMcjuP+QCUB0uAbdtHNzGS1d2Vc1E/GnmjNg2HMbSuYEMlujl7muZ0Y3tNmqJs8IIqysy89qJzoA1yc436U3Npw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XPHIv4TU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A68FBC2BD10; Mon, 27 May 2024 00:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716768280; bh=PcmYPBGo2XhGqyaercyt+IZ2k2DlEHd7kUXcc3kQ2Eg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XPHIv4TUHywo6ZiY57edG8kmeD1+Rq26K8hDgEJMBVnMLGbM9vHo1Oy8CL+dTsGpY mQi3lpj9L/726bC4JQz4oY48jQrnT+iM0YOR/2HpzfJd7W6XAaGEGAiMXMACo67O+L GNzm3KMhZzmiWDLJNW5Gg0I8O0kjMSIdE0VNnU03cxndP5IqGF+0tc54/lM5e+q910 pVM/rise3d+5ZJpDNoYYZZiLQrL1UorcdoXt7grS4Mb/kRLrNxWYlnBrOsT9J533qJ nTcaXRdGOy0UE84Xl/Kmq29Vp5v+Ohkq4WG8rJJwouDUZh5CeloxpfkGyYb6ekbATa M20Pi0Yu92zfw== Date: Mon, 27 May 2024 09:04:34 +0900 From: Masami Hiramatsu (Google) To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, 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: Re: [PATCH 19/20] function_graph: Use for_each_set_bit() in __ftrace_return_to_handler() Message-Id: <20240527090434.37e309d0280d6d8f116edc85@kernel.org> In-Reply-To: <20240525023744.231570357@goodmis.org> References: <20240525023652.903909489@goodmis.org> <20240525023744.231570357@goodmis.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 24 May 2024 22:37:11 -0400 Steven Rostedt wrote: > 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) Ah, nit: maybe this is unlikely()? Thank you, -- Masami Hiramatsu (Google)