Re: [PATCH v4 06/24] sched/fair: Collect load-balancing stats for IPC classes

From: Ricardo Neri
Date: Tue Jun 13 2023 - 20:26:29 EST


On Mon, Jun 12, 2023 at 09:24:04PM -0700, Ricardo Neri wrote:
> +static int rq_last_task_ipcc(int dst_cpu, struct rq *rq, unsigned short *ipcc)
> +{
> + struct list_head *tasks = &rq->cfs_tasks;
> + struct task_struct *p;
> + struct rq_flags rf;
> + int ret = -EINVAL;
> +
> + rq_lock_irqsave(rq, &rf);
> + if (list_empty(tasks))
> + goto out;
> +
> + p = list_last_entry(tasks, struct task_struct, se.group_node);
> + if (p->flags & PF_EXITING || is_idle_task(p) ||
> + !cpumask_test_cpu(dst_cpu, p->cpus_ptr))
> + goto out;
> +
> + ret = 0;
> + *ipcc = p->ipcc;
> +out:
> + rq_unlock(rq, &rf);

This should be rq_unlock_irqrestore(). I will correct it in the next version.