linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bert Karwatzki <spasswolf@web.de>
To: Tejun Heo <tj@kernel.org>
Cc: Bert Karwatzki <spasswolf@web.de>,
	Calvin Owens <calvin@wbinvd.org>,
	bigeasy@linutronix.de, dschatzberg@meta.com,
	peterz@infradead.org, linux-kernel@vger.kernel.org,
	linux-next@vger.kernel.org
Subject: [PATCH] cgroup: include missing header for struct irq_work
Date: Tue, 11 Nov 2025 18:01:43 +0100	[thread overview]
Message-ID: <20251111170145.106356-1-spasswolf@web.de> (raw)
In-Reply-To: https://lore.kernel.org/r/20251104181114.489391-1-calvin@wbinvd.org

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

             reply	other threads:[~2025-11-11 17:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-11 17:01 Bert Karwatzki [this message]
2025-11-11 18:57 ` [PATCH] cgroup: include missing header for struct irq_work Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251111170145.106356-1-spasswolf@web.de \
    --to=spasswolf@web.de \
    --cc=bigeasy@linutronix.de \
    --cc=calvin@wbinvd.org \
    --cc=dschatzberg@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).