File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -7111,7 +7111,28 @@ static int ftrace_process_locs(struct module *mod,
7111
7111
7112
7112
/* We should have used all pages unless we skipped some */
7113
7113
if (pg_unuse ) {
7114
- WARN_ON (!skipped );
7114
+ unsigned long pg_remaining , remaining = 0 ;
7115
+ unsigned long skip ;
7116
+
7117
+ /* Count the number of entries unused and compare it to skipped. */
7118
+ pg_remaining = (ENTRIES_PER_PAGE << pg -> order ) - pg -> index ;
7119
+
7120
+ if (!WARN (skipped < pg_remaining , "Extra allocated pages for ftrace" )) {
7121
+
7122
+ skip = skipped - pg_remaining ;
7123
+
7124
+ for (pg = pg_unuse ; pg ; pg = pg -> next )
7125
+ remaining += 1 << pg -> order ;
7126
+
7127
+ skip = DIV_ROUND_UP (skip , ENTRIES_PER_PAGE );
7128
+
7129
+ /*
7130
+ * Check to see if the number of pages remaining would
7131
+ * just fit the number of entries skipped.
7132
+ */
7133
+ WARN (skip != remaining , "Extra allocated pages for ftrace: %lu with %lu skipped" ,
7134
+ remaining , skipped );
7135
+ }
7115
7136
/* Need to synchronize with ftrace_location_range() */
7116
7137
synchronize_rcu ();
7117
7138
ftrace_free_pages (pg_unuse );
You can’t perform that action at this time.
0 commit comments