All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] genirq/irqaction: Move dev_id and percpu_dev_id in a union
@ 2021-04-10 12:00 Marc Zyngier
  2021-04-18 23:44 ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2021-04-10 12:00 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel, kernel-team

dev_id and percpu_dev_id are mutually exclusive in struct irqaction,
as they conceptually represent the same thing, only in a per-cpu
fashion.

Move them into an anonymous union, saving a few bytes on the way.

Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 include/linux/interrupt.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 967e25767153..4383ee033acf 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -109,8 +109,10 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
  */
 struct irqaction {
 	irq_handler_t		handler;
-	void			*dev_id;
-	void __percpu		*percpu_dev_id;
+	union {
+		void		*dev_id;
+		void __percpu	*percpu_dev_id;
+	};
 	struct irqaction	*next;
 	irq_handler_t		thread_fn;
 	struct task_struct	*thread;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] genirq/irqaction: Move dev_id and percpu_dev_id in a union
  2021-04-10 12:00 [PATCH] genirq/irqaction: Move dev_id and percpu_dev_id in a union Marc Zyngier
@ 2021-04-18 23:44 ` Thomas Gleixner
  2021-04-20  9:08   ` Marc Zyngier
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2021-04-18 23:44 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: linux-kernel, kernel-team

On Sat, Apr 10 2021 at 13:00, Marc Zyngier wrote:
> dev_id and percpu_dev_id are mutually exclusive in struct irqaction,
> as they conceptually represent the same thing, only in a per-cpu
> fashion.
>
> Move them into an anonymous union, saving a few bytes on the way.

The reason why they are not in an anomymous union is that any misuse of
interfaces will result in an instantaneous explosion while with your
variant it will cause hard to diagnose side effects.

I rather waste the extra 4/8 bytes unless there is a compelling reason
not to do so.

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] genirq/irqaction: Move dev_id and percpu_dev_id in a union
  2021-04-18 23:44 ` Thomas Gleixner
@ 2021-04-20  9:08   ` Marc Zyngier
  0 siblings, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2021-04-20  9:08 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel, kernel-team

On Mon, 19 Apr 2021 00:44:14 +0100,
Thomas Gleixner <tglx@linutronix.de> wrote:
> 
> On Sat, Apr 10 2021 at 13:00, Marc Zyngier wrote:
> > dev_id and percpu_dev_id are mutually exclusive in struct irqaction,
> > as they conceptually represent the same thing, only in a per-cpu
> > fashion.
> >
> > Move them into an anonymous union, saving a few bytes on the way.
> 
> The reason why they are not in an anomymous union is that any misuse of
> interfaces will result in an instantaneous explosion while with your
> variant it will cause hard to diagnose side effects.
> 
> I rather waste the extra 4/8 bytes unless there is a compelling reason
> not to do so.

Fair enough. I just happened to spot it while doing some vaguely
related rework (turning the irqaction.irq field into an irqdesc).

Happy to leave it as is.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-20  9:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-10 12:00 [PATCH] genirq/irqaction: Move dev_id and percpu_dev_id in a union Marc Zyngier
2021-04-18 23:44 ` Thomas Gleixner
2021-04-20  9:08   ` Marc Zyngier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.