[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5df9200f0e7c4bc586af76e21b380f67@honor.com>
Date: Fri, 18 Apr 2025 02:42:55 +0000
From: gaoxu <gaoxu2@...or.com>
To: Tejun Heo <tj@...nel.org>, Johannes Weiner <hannes@...xchg.org>,
"Michal Koutný" <mkoutny@...e.com>
CC: "cgroups@...r.kernel.org" <cgroups@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "Kamalesh
Babulal" <kamalesh.babulal@...cle.com>, "surenb@...gle.com"
<surenb@...gle.com>, yipengxiang <yipengxiang@...or.com>
Subject: [PATCH v2] cgroup: Fix compilation issue due to cgroup_mutex not
being exported
When adding folio_memcg function call in the zram module for
Android 16-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@...or.com>
---
v1 -> v2: update the notes of the description above DEFINE_MUTEX(cgroup_mutex)
per Kamalesh's suggestion.
---
kernel/cgroup/cgroup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 447ac857e..c1bc51058 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -84,13 +84,13 @@
* css_set_lock protects task->cgroups pointer, the list of css_set
* objects, and the chain of tasks off each css_set.
*
- * These locks are exported if CONFIG_PROVE_RCU so that accessors in
- * cgroup.h can use them for lockdep annotations.
+ * These locks are exported if CONFIG_PROVE_RCU or CONFIG_LOCKDEP so that
+ * accessors in cgroup.h can use them for lockdep annotations.
*/
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
Powered by blists - more mailing lists