lkml.org 
[lkml]   [2020]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 5/7] irq_work, smp: Allow irq_work on call_single_queue
On Tue, May 26, 2020 at 06:11:02PM +0200, Peter Zijlstra wrote:
> Currently irq_work_queue_on() will issue an unconditional
> arch_send_call_function_single_ipi() and has the handler do
> irq_work_run().
>
> This is unfortunate in that it makes the IPI handler look at a second
> cacheline and it misses the opportunity to avoid the IPI. Instead note
> that struct irq_work and struct __call_single_data are very similar in
> layout, so use a few bits in the flags word to encode a type and stick
> the irq_work on the call_single_queue list.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> include/linux/irq_work.h | 7 ++
> include/linux/smp.h | 23 ++++++++-
> kernel/irq_work.c | 53 +++++++++++---------
> kernel/smp.c | 119 ++++++++++++++++++++++++++++-------------------
> 4 files changed, 130 insertions(+), 72 deletions(-)
>
> --- a/include/linux/irq_work.h
> +++ b/include/linux/irq_work.h
> @@ -13,6 +13,8 @@
> * busy NULL, 2 -> {free, claimed} : callback in progress, can be claimed
> */
>
> +/* flags share CSD_FLAG_ space */
> +
> #define IRQ_WORK_PENDING BIT(0)
> #define IRQ_WORK_BUSY BIT(1)
>
> @@ -23,9 +25,12 @@
>
> #define IRQ_WORK_CLAIMED (IRQ_WORK_PENDING | IRQ_WORK_BUSY)
>
> +/*
> + * structure shares layout with single_call_data_t.
> + */
> struct irq_work {
> - atomic_t flags;
> struct llist_node llnode;
> + atomic_t flags;


We should probably have:

struct csd_node {
atomic_t flags;
struct llist_node;
}

embed inside struct irq_work and struct __call_single_data. Relying on
structure layout for things to work doesn't really clarify things :-)

Thanks.

\
 
 \ /
  Last update: 2020-05-29 01:40    [W:0.215 / U:6.800 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site