From nobody Wed Nov 27 17:46:44 2024 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 C7C5E194AEB for ; Wed, 9 Oct 2024 13:21:14 +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=1728480074; cv=none; b=BNJbB7SR2Z8zWY75mKDzMipqnwVA/9DhmE6PCo+1KigmLXvyn/84RIHiF4UiHnqW0ZxZ0WSR5M+kH/qOUr0CB0gasjIQdEIOhiQBhWg34P0TeqQ0AEN0BE+IE6INX/rVWC9I+m0Wl5YYCVGrQLP35wpixUwXv5taDc8Uvvx7YEs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728480074; c=relaxed/simple; bh=ERoXFPVgC1wX2vu2OhU6ijnkpELxgnhoNg6sfXACYw8=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Vy3sbXiCyn9VpP4H/TDs/7SY0IlCY1Gd1PFyfGhwYc1h3C8OBXd+Lhjnfgp1WVEo2M9vNdhIjqFsZAL3cz6x1PPb9aKQ647717lBxsPlX8vqWe69JixihNk6n5h5D4jfrvR6wNgXwI8oYjIT3f1VbwxQXwlRgA5naEMqo2S/J4Y= 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 4E896C4CECF; Wed, 9 Oct 2024 13:21:14 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1syWcx-0000000175r-3LVt; Wed, 09 Oct 2024 09:21:19 -0400 Message-ID: <20241009132119.658356665@goodmis.org> User-Agent: quilt/0.68 Date: Wed, 09 Oct 2024 09:21:05 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Li Chen Subject: [for-next][PATCH 1/6] ftrace: Use this_cpu_ptr() instead of per_cpu_ptr(smp_processor_id()) References: <20241009132104.470687911@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Li Chen Use this_cpu_ptr() instead of open coding the equivalent in various ftrace functions. Cc: Mathieu Desnoyers Cc: Masami Hiramatsu Link: https://lore.kernel.org/87y14t6ofi.wl-me@linux.beauty Signed-off-by: Li Chen Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_functions.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index 3b0cea37e029..65fed0bbc5c2 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c @@ -184,7 +184,6 @@ function_trace_call(unsigned long ip, unsigned long par= ent_ip, struct trace_array_cpu *data; unsigned int trace_ctx; int bit; - int cpu; =20 if (unlikely(!tr->function_enabled)) return; @@ -195,8 +194,7 @@ function_trace_call(unsigned long ip, unsigned long par= ent_ip, =20 trace_ctx =3D tracing_gen_ctx(); =20 - cpu =3D smp_processor_id(); - data =3D per_cpu_ptr(tr->array_buffer.data, cpu); + data =3D this_cpu_ptr(tr->array_buffer.data); if (!atomic_read(&data->disabled)) trace_function(tr, ip, parent_ip, trace_ctx); =20 @@ -300,7 +298,6 @@ function_no_repeats_trace_call(unsigned long ip, unsign= ed long parent_ip, unsigned int trace_ctx; unsigned long flags; int bit; - int cpu; =20 if (unlikely(!tr->function_enabled)) return; @@ -309,8 +306,7 @@ function_no_repeats_trace_call(unsigned long ip, unsign= ed long parent_ip, if (bit < 0) return; =20 - cpu =3D smp_processor_id(); - data =3D per_cpu_ptr(tr->array_buffer.data, cpu); + data =3D this_cpu_ptr(tr->array_buffer.data); if (atomic_read(&data->disabled)) goto out; =20 @@ -321,7 +317,7 @@ function_no_repeats_trace_call(unsigned long ip, unsign= ed long parent_ip, * TODO: think about a solution that is better than just hoping to be * lucky. */ - last_info =3D per_cpu_ptr(tr->last_func_repeats, cpu); + last_info =3D this_cpu_ptr(tr->last_func_repeats); if (is_repeat_check(tr, last_info, ip, parent_ip)) goto out; =20 --=20 2.45.2