[-next,2/3] ftrace: Optimize the allocation for mcount entries

Message ID 20221109094434.84046-3-wangwensheng4@huawei.com
State New
Headers
Series Optimize code for ftrace |

Commit Message

Wang Wensheng Nov. 9, 2022, 9:44 a.m. UTC
  If we can't allocate this size, try something smaller with half of the
size. Its order should be decreased by one instead of divided by two.

Signed-off-by: Wang Wensheng <wangwensheng4@huawei.com>
---
 kernel/trace/ftrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index c571c2813c11..43a958b28022 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3200,7 +3200,7 @@  static int ftrace_allocate_records(struct ftrace_page *pg, int count)
 		/* if we can't allocate this size, try something smaller */
 		if (!order)
 			return -ENOMEM;
-		order >>= 1;
+		order--;
 		goto again;
 	}