From d9640f2fc5a3decb3a2f401962e70ea5e734ff5d Mon Sep 17 00:00:00 2001 From: Li Zetao Date: Wed, 8 May 2024 17:20:08 +0800 Subject: [PATCH] sched/fair: Optimize performance by inlining cpu_util_without() and cpu_util() hulk inclusion category: performance bugzilla: https://gitee.com/openeuler/kernel/issues/I9MSNE?from=project-issue CVE: NA -------------------------------- Consider optimizing performance by inlining high-frequency hotspot functions. The test results are as follows: base base+this patch fork_proc 438.5427333ms 420.5897667ms (4.27%) Signed-off-by: Zhang Qiao Signed-off-by: Li Zetao --- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7b0cb2f090da..40c4f9eb39ad 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8442,7 +8442,7 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target) * * Return: (Boosted) (estimated) utilization for the specified CPU. */ -static unsigned long +static inline unsigned long cpu_util(int cpu, struct task_struct *p, int dst_cpu, int boost) { struct cfs_rq *cfs_rq = &cpu_rq(cpu)->cfs; @@ -8530,7 +8530,7 @@ unsigned long cpu_util_cfs_boost(int cpu) * utilization of the specified task, whenever the task is currently * contributing to the CPU utilization. */ -static unsigned long cpu_util_without(int cpu, struct task_struct *p) +static inline unsigned long cpu_util_without(int cpu, struct task_struct *p) { /* Task has no contribution or is new */ if (cpu != task_cpu(p) || !READ_ONCE(p->se.avg.last_update_time)) -- Gitee