Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1763216lqb; Sun, 26 May 2024 16:58:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/IcD0CGjvByWuSF+uTv5z9gy46sBWqzCfpZsdBrsOopdt5xnxWNtxNdZWQlDozf0abEul+NYKrwzkGFyPJH23lfzAtu0bMkg+JrqMQA== X-Google-Smtp-Source: AGHT+IERXU6c5ahHY8IC8dtw/b2gTWJ9NnwmdGo3vZxK92hC7fQ1ggAW4t6DnC/MvpfMOadVrbng X-Received: by 2002:a05:6214:240f:b0:6ad:78aa:9150 with SMTP id 6a1803df08f44-6ad78aa946bmr29359066d6.8.1716767939496; Sun, 26 May 2024 16:58:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716767939; cv=pass; d=google.com; s=arc-20160816; b=Dy7nwk3eBl72JPcZXiRbgihYqEuSpek7oxa2M3NEt0qLtbKypaBDN9ti5qBlfhmr88 T15NSapI2byGGl47lALEzMIAXrUT3iN1kUd4rorR1qGR30Vmtag/z+xVbm3UYqGbvt92 txVUrmlkqz7ckstPer+UHX1+nKVaGVrm0nybT7K5g4BzqhhGbDHEJ8Nk336z3KCLHckp YLKRoP2PuFnU+ZtKkl4m3gqbZxLJWZSCSSOUDDFa4Rcf4uHdX/P1I88PCVMH647c6s5X b2fd7qBzfahpB0BcTg3+b0SEv4XdznvT/TZLHvhbJx9EhhI9qMLOhpZ044hpkm517z9X RlwQ== 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=fHoGzvQGRvFOeYOWBOG/+6QpYvcuGXHPgut0QYuVWi8=; fh=jPbTOLaFRquCWSHePkx5JyHgrJfqc0pfK3tHoljjLqk=; b=UN5gLdLZpShOZzH9hrwveZlsakJYfM8ArMa61kF5DAKqx6MNIvkTeebfSJwyv2txOP vpOnHiKPFBEGSMy+ER/yPg1uJ+U2TElBXxloYr0WXyMcUBklJM3wAYsBQjFBX3nzFYrO /04jk/Y+szQoFvAOd7gF2vKf7PPPvZ7bjzlUTolHjr3aLnxHvCni/T8JEfYSonJI9K/j oKkL6TCWDGsXyDZfJh5iIBMsninwUfsae9dZ9Qjf8gMcaxStRfXmSEprtmBzJlJy8V/J tJI2odrNP/QCxeTI85BkwMcJHA9LxGEZNn4yMoJS/L7yQS0pimxyvlxrAPYHbebX+NWl WRvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FhkSU46r; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-189903-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189903-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ac0707d602si69532826d6.157.2024.05.26.16.58.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 16:58:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189903-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FhkSU46r; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-189903-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189903-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3A6B21C20C8F for ; Sun, 26 May 2024 23:58:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1811113A3FC; Sun, 26 May 2024 23:58:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FhkSU46r" 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 359EF2F46; Sun, 26 May 2024 23:58:47 +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=1716767928; cv=none; b=obLl4FGX8hBfTYyP3XeKv4e1LXvMvS0kR61fBpKozdCrIXtDXZbPJYA2l7M2rmWRtUSWuBhOUgDB0O/toAj2/YrI7tNaol1Z/W+yXmqlBJ488uyK0pdDLXXzJy9IUo6OKxYxjAi59dnrN5mO+Zh6dKTSEmhsifpsdy5GvsLZ5Dg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716767928; c=relaxed/simple; bh=b5DjLreslgkKOr9CzOVLysgDaJanR6GoFnpSSYrVds8=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=Uinj/T572ZhMG5s2kTSGAP+1tQJEC48ortG8BU4cGrFYfKSxL5BbyJWNA/Mzg+4UpbEeFFP+WOoosr+RKCsejDAVgx949uVKl8pb3r/8EQVYrJNyPLCEj6TXFzeQ9gKB5AB1+o9HGgVduo5Onzj9Fo939e8kNP67Pj371ymFNss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FhkSU46r; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA695C2BD10; Sun, 26 May 2024 23:58:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716767927; bh=b5DjLreslgkKOr9CzOVLysgDaJanR6GoFnpSSYrVds8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FhkSU46roOIGOu8nIldG3jCi4RxCCFFDyPlOZyPQyxBDbhepVHZ2WLgQOdF8vz3mb PW5sy69JxHdL4CbT0EG17DhGOe526wzeE8No3ViQmEjnkT1ySuAmyi8EiDeprm3WWe UEwqadlcyyAWHkDvUPWsGmQINx2acb4ZUtFdpIMKNjzsAui7P2QKF39jifsB8eYwun 8H5FfVF2PNo/b7MHUkevltyd+FZ8TX338mHJ4ZFdzdiDspJnzQV6/wXQkK7AqGstGO rNSolmr21+EE5BrSmTRHZjPbbEPojScl8UKv5FwOl62Vsr6HLHis//Zq+LMOx0KiTP jNPTpY89nTgOQ== Date: Mon, 27 May 2024 08:58:41 +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: <20240527085841.63b97b1b1926ff9c0a21fb46@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. > Looks good to me. Reviewed-by: Masami Hiramatsu (Google) Thanks, > 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 > > -- Masami Hiramatsu (Google)