Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ebb66a1 authored by Mel Gorman's avatar Mel Gorman Committed by Ingo Molnar
Browse files

sched/fair: Avoid an unnecessary lookup of current CPU ID during wake_affine



The only caller of wake_affine() knows the CPU ID. Pass it in instead of
rechecking it.

Signed-off-by: default avatarMel Gorman <mgorman@techsingularity.net>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Giovanni Gherdovich <ggherdovich@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20180213133730.24064-2-mgorman@techsingularity.net


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent ed029343
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -5751,9 +5751,8 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p,
}

static int wake_affine(struct sched_domain *sd, struct task_struct *p,
		       int prev_cpu, int sync)
		       int this_cpu, int prev_cpu, int sync)
{
	int this_cpu = smp_processor_id();
	int target = nr_cpumask_bits;

	if (sched_feat(WA_IDLE))
@@ -6376,7 +6375,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
		if (cpu == prev_cpu)
			goto pick_cpu;

		new_cpu = wake_affine(affine_sd, p, prev_cpu, sync);
		new_cpu = wake_affine(affine_sd, p, cpu, prev_cpu, sync);
	}

	if (sd && !(sd_flag & SD_BALANCE_FORK)) {