[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87frpv21gy.ffs@tglx>
Date: Thu, 19 Sep 2024 15:54:21 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Steven Davis <goldside000@...look.com>, akpm@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org, Steven Davis <goldside000@...look.com>,
Peter Zijlstra <peterz@...radead.org>, Ankur Arora
<ankur.a.arora@...cle.com>, Frederic Weisbecker <frederic@...nel.org>
Subject: Re: [PATCH] irq_work: Improve CPU Responsiveness in irq_work_sync
with cond_resched()
On Wed, Sep 18 2024 at 11:23, Steven Davis wrote:
> Add cond_resched() to the busy-wait loop in irq_work_sync to improve
> CPU responsiveness and prevent starvation of other tasks.
>
> Previously, the busy-wait loop used cpu_relax() alone, which, while
> reducing power consumption, could still lead to excessive CPU
> monopolization in scenarios where IRQ work remains busy for extended
> periods. By incorporating cond_resched(), the CPU is periodically yielded
> to the scheduler, allowing other tasks to execute and enhancing overall
> system responsiveness.
>
> - while (irq_work_is_busy(work))
> + int retry_count = 0;
> +
> + while (irq_work_is_busy(work)) {
> cpu_relax();
> +
> + if (retry_count++ > 1000) {
> + cond_resched();
> + retry_count = 0;
> + }
Did you verify that all callers are actually calling from preemptible
context?
If so, then we should just get rid of the loop waiting completely and
use the rcu_wait mechanism which RT uses.
Thanks,
tglx
Powered by blists - more mailing lists