Re: [RFC PATCH v3 10/10] sched/fair: Throttle CFS tasks on return to userspace

From: Peter Zijlstra
Date: Fri Jul 12 2024 - 13:13:27 EST


On Thu, Jul 11, 2024 at 03:00:04PM +0200, Valentin Schneider wrote:
> +static void task_throttle_cancel_irq_work_fn(struct irq_work *work)
> +{
> + struct task_struct *p = container_of(work, struct task_struct, unthrottle_irq_work);
> + int cpu = raw_smp_processor_id();
> +
> + CLASS(task_rq_lock, rq_guard)(p);

guard(task_rq_lock)(p);

> + WARN_ON_ONCE(task_cpu(p) != cpu);
> +
> + if (task_has_throttle_work(p) && !task_needs_throttling(p))
> + task_throttle_do_cancel_work(p);
> +}