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

Commit 33eabee8 authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

sched: qhmp: fix hmp_capable detection bug in small task CPU selection



The cpumask_full() returns true only if NR_CPUS bits are set in the
in the bitmask. If NR_CPUS is defined to a value greater than the
number of possible CPUs, hmp_capable returns true even for a SMP
system.

If hmp_capable returns true, the higher capacity cluster CPUs (i.e
all CPUs in a SMP system) are cleared from the initial search for
a mostly_idle CPU. As this search is not successful, the least
busy CPU including an idle CPU is returned while a mostly_idle CPU
is available.  This is resulting in power regression. Fix the
hmp_capable detection by comparing the mpc_mask and cpu_possible_mask
directly.

CRs-Fixed: 993166
Change-Id: Ic046ea300b3fe118df6bd98e54d088979fd90931
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 80f8814a
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -3038,13 +3038,11 @@ static int best_small_task_cpu(struct task_struct *p, int sync)
	int i = task_cpu(p), prev_cpu;
	int hmp_capable;
	u64 tload, cpu_load, min_load = ULLONG_MAX;
	cpumask_t temp;
	cpumask_t search_cpu;
	cpumask_t fb_search_cpu = CPU_MASK_NONE;
	struct rq *rq;

	cpumask_and(&temp, &mpc_mask, cpu_possible_mask);
	hmp_capable = !cpumask_full(&temp);
	hmp_capable = !cpumask_equal(&mpc_mask, cpu_possible_mask);

	cpumask_and(&search_cpu, tsk_cpus_allowed(p), cpu_online_mask);
	if (unlikely(!cpumask_test_cpu(i, &search_cpu))) {