sched/walt: streamline affinity mask

Upstream tracks affinity mask in two ways, p->cpus_ptr and p->cpus_mask.
However, we are currently using these two masks interchangeably.

Currently cpus_ptr points to cpus_mask member in task_struct for most of
the time. One exception being when the task is marked
migration_disabled, during which cpus_ptr could point to a different
mask of single_cpu.

Streamline this to ensure WALT only relies on p->cpus_ptr to determine
CPU affinity, which would be more accurate in migrate_disable situations.

Change-Id: I437ffe531d7417eada71304414654341ce4a4ad9
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
This commit is contained in:
Shaleen Agrawal 2022-04-08 15:48:00 -07:00 committed by Rishabh Bhatnagar
parent b64b350ef4
commit bd13df8ce9
3 changed files with 7 additions and 7 deletions

View File

@ -1094,7 +1094,7 @@ TRACE_EVENT(sched_task_util,
__entry->start_cpu = start_cpu;
__entry->unfilter =
((struct walt_task_struct *) p->android_vendor_data1)->unfilter;
__entry->cpus_allowed = cpumask_bits(&p->cpus_mask)[0];
__entry->cpus_allowed = cpumask_bits(p->cpus_ptr)[0];
__entry->task_boost = per_task_boost(p);
__entry->low_latency = walt_low_latency_task(p);
__entry->iowaited =

View File

@ -4059,7 +4059,7 @@ static void android_rvh_enqueue_task(void *unused, struct rq *rq, struct task_st
if (!double_enqueue)
walt_inc_cumulative_runnable_avg(rq, p);
trace_sched_enq_deq_task(p, 1, cpumask_bits(&p->cpus_mask)[0], is_mvp(wts));
trace_sched_enq_deq_task(p, 1, cpumask_bits(p->cpus_ptr)[0], is_mvp(wts));
}
static void android_rvh_dequeue_task(void *unused, struct rq *rq, struct task_struct *p)
@ -4107,7 +4107,7 @@ static void android_rvh_dequeue_task(void *unused, struct rq *rq, struct task_st
if (!double_dequeue)
walt_dec_cumulative_runnable_avg(rq, p);
trace_sched_enq_deq_task(p, 0, cpumask_bits(&p->cpus_mask)[0], is_mvp(wts));
trace_sched_enq_deq_task(p, 0, cpumask_bits(p->cpus_ptr)[0], is_mvp(wts));
}
static void android_rvh_update_misfit_status(void *unused, struct task_struct *p,

View File

@ -63,7 +63,7 @@ unsigned int sched_capacity_margin_down[WALT_NR_CPUS] = {
static inline bool
bias_to_this_cpu(struct task_struct *p, int cpu, int start_cpu)
{
bool base_test = cpumask_test_cpu(cpu, &p->cpus_mask) &&
bool base_test = cpumask_test_cpu(cpu, p->cpus_ptr) &&
cpu_active(cpu);
struct walt_rq *wrq = (struct walt_rq *) cpu_rq(cpu)->android_vendor_data1;
@ -295,7 +295,7 @@ static void walt_find_best_target(struct sched_domain *sd,
min_exit_latency = INT_MAX;
best_idle_cuml_util = ULONG_MAX;
cpumask_and(&visit_cpus, &p->cpus_mask,
cpumask_and(&visit_cpus, p->cpus_ptr,
&cpu_array[order_index][cluster]);
for_each_cpu(i, &visit_cpus) {
unsigned long capacity_orig = capacity_orig_of(i);
@ -785,7 +785,7 @@ int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu,
struct walt_rq *start_wrq;
if (walt_is_many_wakeup(sibling_count_hint) && prev_cpu != cpu &&
cpumask_test_cpu(prev_cpu, &p->cpus_mask))
cpumask_test_cpu(prev_cpu, p->cpus_ptr))
return prev_cpu;
if (unlikely(!cpu_array))
@ -867,7 +867,7 @@ int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu,
if (READ_ONCE(p->__state) == TASK_WAKING)
delta = task_util(p);
if (cpumask_test_cpu(prev_cpu, &p->cpus_mask) && !__cpu_overutilized(prev_cpu, delta)) {
if (cpumask_test_cpu(prev_cpu, p->cpus_ptr) && !__cpu_overutilized(prev_cpu, delta)) {
if (trace_sched_compute_energy_enabled()) {
memset(&output, 0, sizeof(output));
prev_energy = walt_compute_energy(p, prev_cpu, pd, candidates, fbt_env.prs,