[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211006113529.xgieqegb6u3nxjvx@linutronix.de>
Date: Wed, 6 Oct 2021 13:35:29 +0200
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: linux-kernel@...r.kernel.org
Cc: Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH v2 3/4] irq_work: Handle some irq_work in a per-CPU
thread on PREEMPT_RT
On 2021-10-06 13:18:51 [+0200], To linux-kernel@...r.kernel.org wrote:
> diff --git a/kernel/irq_work.c b/kernel/irq_work.c
> index e789beda8297d..daa5d12522faa 100644
> --- a/kernel/irq_work.c
> +++ b/kernel/irq_work.c
> @@ -18,11 +18,34 @@
> #include <linux/cpu.h>
> #include <linux/notifier.h>
> #include <linux/smp.h>
> +#include <linux/smpboot.h>
> #include <asm/processor.h>
> #include <linux/kasan.h>
>
> static DEFINE_PER_CPU(struct llist_head, raised_list);
> static DEFINE_PER_CPU(struct llist_head, lazy_list);
> +static DEFINE_PER_CPU(struct task_struct *, irq_workd);
> +
> +static void wake_irq_workd(void)
> +{
> + struct task_struct *tsk = __this_cpu_read(irq_workd);
> +
> + if (!llist_empty(this_cpu_ptr(&lazy_list)) && tsk)
> + wake_up_process(tsk);
> +}
#ifdef CONFIG_SMP
> +static void irq_work_wake(struct irq_work *entry)
> +{
> + wake_irq_workd();
> +}
> +
> +static DEFINE_PER_CPU(struct irq_work, irq_work_pending) =
> + IRQ_WORK_INIT_HARD(irq_work_wake);
#endif
> +static int irq_workd_should_run(unsigned int cpu)
> +{
> + return !llist_empty(this_cpu_ptr(&lazy_list));
> +}
>
> /*
> * Claim the entry so that no one else will poke at it.
Sebastian
Powered by blists - more mailing lists