Commit f7f64bb3 authored by Li Zetao's avatar Li Zetao
Browse files

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: default avatarZhang Qiao <zhangqiao22@huawei.com>
Signed-off-by: default avatarLi Zetao <lizetao1@huawei.com>
parent afd82dd9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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 __always_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 __always_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))