linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cgroup: include missing header for struct irq_work
@ 2025-11-11 17:01 Bert Karwatzki
  2025-11-11 18:57 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Bert Karwatzki @ 2025-11-11 17:01 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Bert Karwatzki, Calvin Owens, bigeasy, dschatzberg, peterz,
	linux-kernel, linux-next

To compile cgroup.c with PREEMPT_RT=y include header which declares
struct irq_work.

Fixes: 9311e6c29b34 ("cgroup: Fix sleeping from invalid context warning on PREEMPT_RT")

Signed-off-by: Bert Karwatzki <spasswolf@web.de>
---
 kernel/cgroup/cgroup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 0cabc2081e8b..dd114fda37b2 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -60,6 +60,7 @@
 #include <linux/sched/deadline.h>
 #include <linux/psi.h>
 #include <linux/nstree.h>
+#include <linux/irq_work.h>
 #include <net/sock.h>
 
 #define CREATE_TRACE_POINTS
-- 
2.47.3

For me compiling next-20251111 with PREEMPT_RT=y failed with the following
build error:

In file included from ./include/asm-generic/percpu.h:9,
                 from ./arch/x86/include/asm/percpu.h:598,
                 from ./arch/x86/include/asm/current.h:11,
                 from ./include/linux/sched.h:12,
                 from ./include/linux/cgroup.h:12,
                 from kernel/cgroup/cgroup-internal.h:5,
                 from kernel/cgroup/cgroup.c:31:
kernel/cgroup/cgroup.c: In function ‘cgroup_rt_init’:
./include/linux/percpu-defs.h:221:59: error: invalid use of undefined type ‘struct irq_work’
  221 |         const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
      |                                                           ^
./include/linux/percpu-defs.h:239:9: note: in expansion of macro ‘__verify_pcpu_ptr’
  239 |         __verify_pcpu_ptr(ptr);                                         \
      |         ^~~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:273:35: note: in expansion of macro ‘per_cpu_ptr’
  273 | #define per_cpu(var, cpu)       (*per_cpu_ptr(&(var), cpu))
      |                                   ^~~~~~~~~~~
kernel/cgroup/cgroup.c:7059:17: note: in expansion of macro ‘per_cpu’
 7059 |                 per_cpu(cgrp_dead_tasks_iwork, cpu) =
      |                 ^~~~~~~
  CC      net/ipv6/sysctl_net_ipv6.o
kernel/cgroup/cgroup.c:7060:25: error: implicit declaration of function ‘IRQ_WORK_INIT_LAZY’ [-Wimplicit-function-declaration]
 7060 |                         IRQ_WORK_INIT_LAZY(cgrp_dead_tasks_iwork_fn);
      |                         ^~~~~~~~~~~~~~~~~~
kernel/cgroup/cgroup.c:7059:53: error: invalid use of undefined type ‘struct irq_work’
 7059 |                 per_cpu(cgrp_dead_tasks_iwork, cpu) =
      |                                                     ^
  CC      drivers/connector/cn_queue.o
kernel/cgroup/cgroup.c: In function ‘cgroup_task_dead’:
kernel/cgroup/cgroup.c:7068:9: error: implicit declaration of function ‘irq_work_queue’; did you mean ‘drain_workqueue’? [-Wimplicit-function-declaration]
 7068 |         irq_work_queue(this_cpu_ptr(&cgrp_dead_tasks_iwork));
      |         ^~~~~~~~~~~~~~
      |         drain_workqueue
./include/linux/percpu-defs.h:221:59: error: invalid use of undefined type ‘struct irq_work’
  221 |         const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
      |                                                           ^
./include/linux/percpu-defs.h:245:9: note: in expansion of macro ‘__verify_pcpu_ptr’
  245 |         __verify_pcpu_ptr(ptr);                                         \
      |         ^~~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:256:27: note: in expansion of macro ‘raw_cpu_ptr’
  256 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
      |                           ^~~~~~~~~~~
kernel/cgroup/cgroup.c:7068:24: note: in expansion of macro ‘this_cpu_ptr’
 7068 |         irq_work_queue(this_cpu_ptr(&cgrp_dead_tasks_iwork));
      |                        ^~~~~~~~~~~~
kernel/cgroup/cgroup.c: At top level:
  CC [M]  fs/nls/nls_ascii.o
kernel/cgroup/cgroup.c:7039:40: error: storage size of ‘cgrp_dead_tasks_iwork’ isn’t known
 7039 | static DEFINE_PER_CPU(struct irq_work, cgrp_dead_tasks_iwork);
      |                                        ^~~~~~~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:103:44: note: in definition of macro ‘DEFINE_PER_CPU_SECTION’
  103 |         __PCPU_ATTRS(sec) __typeof__(type) name
      |                                            ^~~~
kernel/cgroup/cgroup.c:7039:8: note: in expansion of macro ‘DEFINE_PER_CPU’
 7039 | static DEFINE_PER_CPU(struct irq_work, cgrp_dead_tasks_iwork);
      |        ^~~~~~~~~~~~~~
  CC      drivers/acpi/acpica/tbdata.o
make[7]: *** [scripts/Makefile.build:287: kernel/cgroup/cgroup.o] Fehler 1

This patch fixes the error, perhaps you can squeeze this into a v3 of
your commit.

Bert Karwatzki

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

* Re: [PATCH] cgroup: include missing header for struct irq_work
  2025-11-11 17:01 [PATCH] cgroup: include missing header for struct irq_work Bert Karwatzki
@ 2025-11-11 18:57 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2025-11-11 18:57 UTC (permalink / raw)
  To: Bert Karwatzki
  Cc: Calvin Owens, bigeasy, dschatzberg, peterz, linux-kernel,
	linux-next

Applied to cgroup/for-6.19.

Thanks.

--
tejun

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

end of thread, other threads:[~2025-11-11 18:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-11 17:01 [PATCH] cgroup: include missing header for struct irq_work Bert Karwatzki
2025-11-11 18:57 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).