public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Guenter Roeck <linux@roeck-us.net>
Subject: [for-next][PATCH 10/15] ftrace: Introduce and use ENTRIES_PER_PAGE_GROUP macro
Date: Tue, 27 Jan 2026 10:06:05 -0500	[thread overview]
Message-ID: <20260127150612.953117141@kernel.org> (raw)
In-Reply-To: 20260127150555.840066272@kernel.org

From: Guenter Roeck <linux@roeck-us.net>

ENTRIES_PER_PAGE_GROUP() returns the number of dyn_ftrace entries in a page
group, identified by its order.

No functional change.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://patch.msgid.link/20260113152243.3557219-2-linux@roeck-us.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index aa758efc3731..df4ce244202e 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1148,6 +1148,7 @@ struct ftrace_page {
 };
 
 #define ENTRY_SIZE sizeof(struct dyn_ftrace)
+#define ENTRIES_PER_PAGE_GROUP(order) ((PAGE_SIZE << (order)) / ENTRY_SIZE)
 
 static struct ftrace_page	*ftrace_pages_start;
 static struct ftrace_page	*ftrace_pages;
@@ -3862,7 +3863,7 @@ static int ftrace_allocate_records(struct ftrace_page *pg, int count,
 	*num_pages += 1 << order;
 	ftrace_number_of_groups++;
 
-	cnt = (PAGE_SIZE << order) / ENTRY_SIZE;
+	cnt = ENTRIES_PER_PAGE_GROUP(order);
 	pg->order = order;
 
 	if (cnt > count)
@@ -7309,7 +7310,7 @@ static int ftrace_process_locs(struct module *mod,
 		long skip;
 
 		/* Count the number of entries unused and compare it to skipped. */
-		pg_remaining = (PAGE_SIZE << pg->order) / ENTRY_SIZE - pg->index;
+		pg_remaining = ENTRIES_PER_PAGE_GROUP(pg->order) - pg->index;
 
 		if (!WARN(skipped < pg_remaining, "Extra allocated pages for ftrace")) {
 
@@ -7317,7 +7318,7 @@ static int ftrace_process_locs(struct module *mod,
 
 			for (pg = pg_unuse; pg && skip > 0; pg = pg->next) {
 				remaining += 1 << pg->order;
-				skip -= (PAGE_SIZE << pg->order) / ENTRY_SIZE;
+				skip -= ENTRIES_PER_PAGE_GROUP(pg->order);
 			}
 
 			pages -= remaining;
-- 
2.51.0



  parent reply	other threads:[~2026-01-27 15:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27 15:05 [for-next][PATCH 00/15] tracing: Updates for 6.20 Steven Rostedt
2026-01-27 15:05 ` [for-next][PATCH 01/15] tracing: Properly process error handling in event_hist_trigger_parse() Steven Rostedt
2026-01-27 15:05 ` [for-next][PATCH 02/15] tracing: Remove redundant call to event_trigger_reset_filter() " Steven Rostedt
2026-01-27 15:05 ` [for-next][PATCH 03/15] tracing: Add bitmask-list option for human-readable bitmask display Steven Rostedt
2026-01-27 15:05 ` [for-next][PATCH 04/15] tracing: Replace use of system_wq with system_dfl_wq Steven Rostedt
2026-01-27 15:06 ` [for-next][PATCH 05/15] tracing: Add show_event_filters to expose active event filters Steven Rostedt
2026-01-27 15:06 ` [for-next][PATCH 06/15] tracing: Add show_event_triggers to expose active event triggers Steven Rostedt
2026-01-27 15:06 ` [for-next][PATCH 07/15] tracing: Check the return value of tracing_update_buffers() Steven Rostedt
2026-01-27 15:06 ` [for-next][PATCH 08/15] ring-buffer: Use a housekeeping CPU to wake up waiters Steven Rostedt
2026-01-27 15:06 ` [for-next][PATCH 09/15] tracing: Have show_event_trigger/filter format a bit more in columns Steven Rostedt
2026-01-27 15:06 ` Steven Rostedt [this message]
2026-01-27 15:06 ` [for-next][PATCH 11/15] tracing: Disable trace_printk buffer on warning too Steven Rostedt
2026-01-27 15:06 ` [for-next][PATCH 12/15] tracing: Have hist_debug show what function a field uses Steven Rostedt
2026-01-27 15:06 ` [for-next][PATCH 13/15] tracing: Remove notrace from trace_event_raw_event_synth() Steven Rostedt
2026-01-27 15:06 ` [for-next][PATCH 14/15] tracing: Up the hist stacktrace size from 16 to 31 Steven Rostedt
2026-01-27 15:06 ` [for-next][PATCH 15/15] tracing: Remove duplicate ENABLE_EVENT_STR and DISABLE_EVENT_STR macros Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260127150612.953117141@kernel.org \
    --to=rostedt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox