Message ID | 20240711130004.2157737-3-vschneid@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | sched/fair: Defer CFS throttle to user entry | expand |
On Thu, Jul 11, 2024 at 02:59:56PM +0200, Valentin Schneider wrote: > A later commit will add a struct irq_work member to struct task_struct, which > would require <linux/sched.h> to include the definition of struct > irq_work. > > Thanks to header dependency hell, incudling <linux/irq_work.h> in <linux/sched.h> > results in defining inline helpers using not-yet-defined fields (mm_struct, > task_struct, various task states...). > > Break off the definition of struct irq_work into its own header file. > > Signed-off-by: Valentin Schneider <vschneid@redhat.com> > --- > include/linux/irq_work.h | 8 ++------ > include/linux/irq_work_types.h | 14 ++++++++++++++ > 2 files changed, 16 insertions(+), 6 deletions(-) > create mode 100644 include/linux/irq_work_types.h > > diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h > index 136f2980cba30..7f6d2af360d91 100644 > --- a/include/linux/irq_work.h > +++ b/include/linux/irq_work.h > @@ -5,6 +5,8 @@ > #include <linux/smp_types.h> > #include <linux/rcuwait.h> > > +#include <linux/irq_work_types.h> > + > /* > * An entry can be in one of four states: > * > @@ -14,12 +16,6 @@ > * busy NULL, 2 -> {free, claimed} : callback in progress, can be claimed > */ > > -struct irq_work { > - struct __call_single_node node; > - void (*func)(struct irq_work *); > - struct rcuwait irqwait; > -}; > - > #define __IRQ_WORK_INIT(_func, _flags) (struct irq_work){ \ > .node = { .u_flags = (_flags), }, \ > .func = (_func), \ > diff --git a/include/linux/irq_work_types.h b/include/linux/irq_work_types.h > new file mode 100644 > index 0000000000000..108cbc514733b > --- /dev/null > +++ b/include/linux/irq_work_types.h > @@ -0,0 +1,14 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +#ifndef _LINUX_IRQ_WORK_TYPES_H > +#define _LINUX_IRQ_WORK_TYPES_H > + > +#include <linux/smp_types.h> > +#include <linux/rcuwait_types.h> > + > +struct irq_work { > + struct __call_single_node node; > + void (*func)(struct irq_work *); > + struct rcuwait irqwait; > +}; > + > +#endif Since smp_types.h already mentions IRQ_WORK, given how I tangled the whole things together, should we just put this struct there as well?
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h index 136f2980cba30..7f6d2af360d91 100644 --- a/include/linux/irq_work.h +++ b/include/linux/irq_work.h @@ -5,6 +5,8 @@ #include <linux/smp_types.h> #include <linux/rcuwait.h> +#include <linux/irq_work_types.h> + /* * An entry can be in one of four states: * @@ -14,12 +16,6 @@ * busy NULL, 2 -> {free, claimed} : callback in progress, can be claimed */ -struct irq_work { - struct __call_single_node node; - void (*func)(struct irq_work *); - struct rcuwait irqwait; -}; - #define __IRQ_WORK_INIT(_func, _flags) (struct irq_work){ \ .node = { .u_flags = (_flags), }, \ .func = (_func), \ diff --git a/include/linux/irq_work_types.h b/include/linux/irq_work_types.h new file mode 100644 index 0000000000000..108cbc514733b --- /dev/null +++ b/include/linux/irq_work_types.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_IRQ_WORK_TYPES_H +#define _LINUX_IRQ_WORK_TYPES_H + +#include <linux/smp_types.h> +#include <linux/rcuwait_types.h> + +struct irq_work { + struct __call_single_node node; + void (*func)(struct irq_work *); + struct rcuwait irqwait; +}; + +#endif
A later commit will add a struct irq_work member to struct task_struct, which would require <linux/sched.h> to include the definition of struct irq_work. Thanks to header dependency hell, incudling <linux/irq_work.h> in <linux/sched.h> results in defining inline helpers using not-yet-defined fields (mm_struct, task_struct, various task states...). Break off the definition of struct irq_work into its own header file. Signed-off-by: Valentin Schneider <vschneid@redhat.com> --- include/linux/irq_work.h | 8 ++------ include/linux/irq_work_types.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 include/linux/irq_work_types.h