* [PATCH] cgroup: Fix compilation issue due to cgroup_mutex not being exported
@ 2025-04-17 7:30 gaoxu
2025-04-17 9:18 ` Michal Koutný
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: gaoxu @ 2025-04-17 7:30 UTC (permalink / raw)
To: Tejun Heo, Johannes Weiner, "Michal Koutný"
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
surenb@google.com, yipengxiang
When adding folio_memcg function call in the zram module for
Android16-6.12, the following error occurs during compilation:
ERROR: modpost: "cgroup_mutex" [../soc-repo/zram.ko] undefined!
This error is caused by the indirect call to lockdep_is_held(&cgroup_mutex)
within folio_memcg. The export setting for cgroup_mutex is controlled by
the CONFIG_PROVE_RCU macro. If CONFIG_LOCKDEP is enabled while
CONFIG_PROVE_RCU is not, this compilation error will occur.
To resolve this issue, add a parallel macro CONFIG_LOCKDEP control to
ensure cgroup_mutex is properly exported when needed.
Signed-off-by: gao xu <gaoxu2@honor.com>
---
kernel/cgroup/cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 447ac857e..9e60ff629 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -90,7 +90,7 @@
DEFINE_MUTEX(cgroup_mutex);
DEFINE_SPINLOCK(css_set_lock);
-#ifdef CONFIG_PROVE_RCU
+#if (defined CONFIG_PROVE_RCU || defined CONFIG_LOCKDEP)
EXPORT_SYMBOL_GPL(cgroup_mutex);
EXPORT_SYMBOL_GPL(css_set_lock);
#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] cgroup: Fix compilation issue due to cgroup_mutex not being exported
2025-04-17 7:30 [PATCH] cgroup: Fix compilation issue due to cgroup_mutex not being exported gaoxu
@ 2025-04-17 9:18 ` Michal Koutný
2025-04-17 16:16 ` Kamalesh Babulal
2025-04-17 16:27 ` Tejun Heo
2 siblings, 0 replies; 5+ messages in thread
From: Michal Koutný @ 2025-04-17 9:18 UTC (permalink / raw)
To: gaoxu
Cc: Tejun Heo, Johannes Weiner, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org, surenb@google.com, yipengxiang
[-- Attachment #1: Type: text/plain, Size: 509 bytes --]
Thanks, Gao.
On Thu, Apr 17, 2025 at 07:30:00AM +0000, gaoxu <gaoxu2@honor.com> wrote:
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@ -90,7 +90,7 @@
> DEFINE_MUTEX(cgroup_mutex);
> DEFINE_SPINLOCK(css_set_lock);
>
> -#ifdef CONFIG_PROVE_RCU
> +#if (defined CONFIG_PROVE_RCU || defined CONFIG_LOCKDEP)
#if defined(CONFIG_PROVE_RCU) || defined(CONFIG_LOCKDEP)
seems more conventional wrt existing code.
But in principle
Acked-by: Michal Koutný <mkoutny@suse.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup: Fix compilation issue due to cgroup_mutex not being exported
2025-04-17 7:30 [PATCH] cgroup: Fix compilation issue due to cgroup_mutex not being exported gaoxu
2025-04-17 9:18 ` Michal Koutný
@ 2025-04-17 16:16 ` Kamalesh Babulal
2025-04-18 2:03 ` 回复: " gaoxu
2025-04-17 16:27 ` Tejun Heo
2 siblings, 1 reply; 5+ messages in thread
From: Kamalesh Babulal @ 2025-04-17 16:16 UTC (permalink / raw)
To: gaoxu, Tejun Heo, Johannes Weiner, Michal Koutný
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
surenb@google.com, yipengxiang
On 4/17/25 1:00 PM, gaoxu wrote:
[...]
> diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
> index 447ac857e..9e60ff629 100644
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@ -90,7 +90,7 @@
> DEFINE_MUTEX(cgroup_mutex);
> DEFINE_SPINLOCK(css_set_lock);
>
> -#ifdef CONFIG_PROVE_RCU
> +#if (defined CONFIG_PROVE_RCU || defined CONFIG_LOCKDEP)
> EXPORT_SYMBOL_GPL(cgroup_mutex);
> EXPORT_SYMBOL_GPL(css_set_lock);
> #endif
It can be triggered when CONFIG_LOCK_STAT=y is enabled, which
selects CONFIG_LOCKDEP=y and sets CONFIG_PROVE_RCU=n. The patch
looks good to me.
You may also want to update the description above DEFINE_MUTEX(cgroup_mutex);
to reflect the modifications introduced by this patch.
--
Cheers,
Kamalesh
^ permalink raw reply [flat|nested] 5+ messages in thread
* 回复: [PATCH] cgroup: Fix compilation issue due to cgroup_mutex not being exported
2025-04-17 16:16 ` Kamalesh Babulal
@ 2025-04-18 2:03 ` gaoxu
0 siblings, 0 replies; 5+ messages in thread
From: gaoxu @ 2025-04-18 2:03 UTC (permalink / raw)
To: Kamalesh Babulal, Tejun Heo, Johannes Weiner, Michal Koutný
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
surenb@google.com, yipengxiang
>
> On 4/17/25 1:00 PM, gaoxu wrote:
> [...]
>
> > diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index
> > 447ac857e..9e60ff629 100644
> > --- a/kernel/cgroup/cgroup.c
> > +++ b/kernel/cgroup/cgroup.c
> > @@ -90,7 +90,7 @@
> > DEFINE_MUTEX(cgroup_mutex);
> > DEFINE_SPINLOCK(css_set_lock);
> >
> > -#ifdef CONFIG_PROVE_RCU
> > +#if (defined CONFIG_PROVE_RCU || defined CONFIG_LOCKDEP)
> > EXPORT_SYMBOL_GPL(cgroup_mutex);
> > EXPORT_SYMBOL_GPL(css_set_lock);
> > #endif
>
>
> It can be triggered when CONFIG_LOCK_STAT=y is enabled, which selects
> CONFIG_LOCKDEP=y and sets CONFIG_PROVE_RCU=n. The patch looks good to
> me.
>
> You may also want to update the description above
> DEFINE_MUTEX(cgroup_mutex); to reflect the modifications introduced by this
> patch.
Received, thanks!
>
> --
> Cheers,
> Kamalesh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup: Fix compilation issue due to cgroup_mutex not being exported
2025-04-17 7:30 [PATCH] cgroup: Fix compilation issue due to cgroup_mutex not being exported gaoxu
2025-04-17 9:18 ` Michal Koutný
2025-04-17 16:16 ` Kamalesh Babulal
@ 2025-04-17 16:27 ` Tejun Heo
2 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2025-04-17 16:27 UTC (permalink / raw)
To: gaoxu
Cc: Johannes Weiner, "Michal Koutný",
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
surenb@google.com, yipengxiang
On Thu, Apr 17, 2025 at 07:30:00AM +0000, gaoxu wrote:
> When adding folio_memcg function call in the zram module for
> Android16-6.12, the following error occurs during compilation:
> ERROR: modpost: "cgroup_mutex" [../soc-repo/zram.ko] undefined!
>
> This error is caused by the indirect call to lockdep_is_held(&cgroup_mutex)
> within folio_memcg. The export setting for cgroup_mutex is controlled by
> the CONFIG_PROVE_RCU macro. If CONFIG_LOCKDEP is enabled while
> CONFIG_PROVE_RCU is not, this compilation error will occur.
>
> To resolve this issue, add a parallel macro CONFIG_LOCKDEP control to
> ensure cgroup_mutex is properly exported when needed.
>
> Signed-off-by: gao xu <gaoxu2@honor.com>
Applied to cgroup/for-6.15-fixes.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-18 2:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-17 7:30 [PATCH] cgroup: Fix compilation issue due to cgroup_mutex not being exported gaoxu
2025-04-17 9:18 ` Michal Koutný
2025-04-17 16:16 ` Kamalesh Babulal
2025-04-18 2:03 ` 回复: " gaoxu
2025-04-17 16:27 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox