Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ftrace: Introduce and use ENTRIES_PER_PAGE_GROUP macro

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>

authored by

Guenter Roeck and committed by
Steven Rostedt (Google)
a9e0c589 2d8b7f9b

+4 -3
+4 -3
kernel/trace/ftrace.c
··· 1148 1148 }; 1149 1149 1150 1150 #define ENTRY_SIZE sizeof(struct dyn_ftrace) 1151 + #define ENTRIES_PER_PAGE_GROUP(order) ((PAGE_SIZE << (order)) / ENTRY_SIZE) 1151 1152 1152 1153 static struct ftrace_page *ftrace_pages_start; 1153 1154 static struct ftrace_page *ftrace_pages; ··· 3863 3862 *num_pages += 1 << order; 3864 3863 ftrace_number_of_groups++; 3865 3864 3866 - cnt = (PAGE_SIZE << order) / ENTRY_SIZE; 3865 + cnt = ENTRIES_PER_PAGE_GROUP(order); 3867 3866 pg->order = order; 3868 3867 3869 3868 if (cnt > count) ··· 7310 7309 long skip; 7311 7310 7312 7311 /* Count the number of entries unused and compare it to skipped. */ 7313 - pg_remaining = (PAGE_SIZE << pg->order) / ENTRY_SIZE - pg->index; 7312 + pg_remaining = ENTRIES_PER_PAGE_GROUP(pg->order) - pg->index; 7314 7313 7315 7314 if (!WARN(skipped < pg_remaining, "Extra allocated pages for ftrace")) { 7316 7315 ··· 7318 7317 7319 7318 for (pg = pg_unuse; pg && skip > 0; pg = pg->next) { 7320 7319 remaining += 1 << pg->order; 7321 - skip -= (PAGE_SIZE << pg->order) / ENTRY_SIZE; 7320 + skip -= ENTRIES_PER_PAGE_GROUP(pg->order); 7322 7321 } 7323 7322 7324 7323 pages -= remaining;