From: Frederic Weisbecker <frederic@kernel.org>
To: Steven Davis <goldside000@outlook.com>
Cc: akpm@linux-foundation.org, ankur.a.arora@oracle.com,
linux-kernel@vger.kernel.org, peterz@infradead.org,
tglx@linutronix.de
Subject: Re: [PATCH] irq_work: Replace wait loop with rcuwait_wait_event
Date: Thu, 19 Sep 2024 18:28:53 +0200 [thread overview]
Message-ID: <ZuxRRZh-2NAlj96l@localhost.localdomain> (raw)
In-Reply-To: <SJ2P223MB10267BCF19A4A37747A52330F7632@SJ2P223MB1026.NAMP223.PROD.OUTLOOK.COM>
Le Thu, Sep 19, 2024 at 11:43:26AM -0400, Steven Davis a écrit :
> The previous implementation of irq_work_sync used a busy-wait
> loop with cpu_relax() to check the status of IRQ work. This
> approach, while functional, could lead to inefficiencies in
> CPU usage.
>
> This commit replaces the busy-wait loop with the rcuwait_wait_event
> mechanism. This change leverages the RCU wait mechanism to handle
> waiting for IRQ work completion more efficiently, improving CPU
> responsiveness and reducing unnecessary CPU usage.
>
> Signed-off-by: Steven Davis <goldside000@outlook.com>
> ---
> kernel/irq_work.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/irq_work.c b/kernel/irq_work.c
> index 2f4fb336dda1..2b092a1d07a9 100644
> --- a/kernel/irq_work.c
> +++ b/kernel/irq_work.c
> @@ -295,8 +295,7 @@ void irq_work_sync(struct irq_work *work)
> return;
> }
>
> - while (irq_work_is_busy(work))
> - cpu_relax();
> + rcuwait_wait_event(&work->irqwait, !irq_work_is_busy(work), TASK_UNINTERRUPTIBLE);
Dan Carpenter brought to my attention this a few weeks ago for another problem.:
perf_remove_from_context() <- disables preempt
__perf_event_exit_context() <- disables preempt
-> __perf_remove_from_context()
-> perf_group_detach()
-> perf_put_aux_event()
-> put_event()
-> _free_event()
-> irq_work_sync()
next prev parent reply other threads:[~2024-09-19 16:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-19 15:43 [PATCH] irq_work: Replace wait loop with rcuwait_wait_event Steven Davis
2024-09-19 16:28 ` Frederic Weisbecker [this message]
2024-09-20 3:10 ` Ankur Arora
2024-09-20 18:22 ` Steven Davis
2024-09-23 6:35 ` Ankur Arora
2024-09-23 21:37 ` Frederic Weisbecker
2024-09-23 21:41 ` Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZuxRRZh-2NAlj96l@localhost.localdomain \
--to=frederic@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=ankur.a.arora@oracle.com \
--cc=goldside000@outlook.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox