ftrace: Optimize the allocation for mcount entries

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.

Link: https://lkml.kernel.org/r/20221109094434.84046-3-wangwensheng4@huawei.com

Cc: <mhiramat@kernel.org>
Cc: <mark.rutland@arm.com>
Cc: stable@vger.kernel.org
Fixes: a79008755497d ("ftrace: Allocate the mcount record pages as groups")
Signed-off-by: Wang Wensheng <wangwensheng4@huawei.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by Wang Wensheng and committed by Steven Rostedt (Google) bcea02b0 08948cae

+1 -1
+1 -1
kernel/trace/ftrace.c
··· 3190 /* if we can't allocate this size, try something smaller */ 3191 if (!order) 3192 return -ENOMEM; 3193 - order >>= 1; 3194 goto again; 3195 } 3196
··· 3190 /* if we can't allocate this size, try something smaller */ 3191 if (!order) 3192 return -ENOMEM; 3193 + order--; 3194 goto again; 3195 } 3196