From nobody Sun Dec 14 12:18:11 2025 Received: from mta20.hihonor.com (mta20.hihonor.com [81.70.206.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B0482638B2; Fri, 18 Apr 2025 02:42:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=81.70.206.69 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744944179; cv=none; b=PfKbVwFsKXPsnbKLqZ1ffiYeo6lpGwzjsNIfuiS1uWDiySs8oXIjSPHfZyBnGaOM6uoqE3kwUhk3FhQcKXNZcgs2cZjR1AfMTb+hbPD8tH1uuI0zXkU9OgY/mCh598Dm1gnOeEAcHaOAB6HIw6tPdVku5rmfTFfzk60IEpx94LY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744944179; c=relaxed/simple; bh=JzLWMs2Szs5aHTCCSNq+CuxhsWOY7R+nLzMPUd/iKxA=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=Qq2SGOJ0EcFQwJkNqtXKA/fPl9mwOL2MCD72mZpBc1/LB7rAF/EVxmk5+Ve/Lhzd7XCUTID4sPPGeDp11cNT3my7nE59UjgqE4Q3u5aGXeucdxYzd1Eb+TmRPfwXbcobhl/ujwSg0NMOLSNGUZB5QWTfgQp/9ey4wl46ZLAMY6s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=honor.com; spf=pass smtp.mailfrom=honor.com; arc=none smtp.client-ip=81.70.206.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=honor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=honor.com Received: from w012.hihonor.com (unknown [10.68.27.189]) by mta20.hihonor.com (SkyGuard) with ESMTPS id 4ZdzXk2W5DzYkxhB; Fri, 18 Apr 2025 10:41:10 +0800 (CST) Received: from a003.hihonor.com (10.68.18.8) by w012.hihonor.com (10.68.27.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 18 Apr 2025 10:42:55 +0800 Received: from a007.hihonor.com (10.68.22.31) by a003.hihonor.com (10.68.18.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 18 Apr 2025 10:42:55 +0800 Received: from a007.hihonor.com ([fe80::e866:83ac:f23b:c25c]) by a007.hihonor.com ([fe80::e866:83ac:f23b:c25c%10]) with mapi id 15.02.1544.011; Fri, 18 Apr 2025 10:42:55 +0800 From: gaoxu To: Tejun Heo , Johannes Weiner , =?utf-8?B?Ik1pY2hhbCBLb3V0bsO9Ig==?= CC: "cgroups@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Kamalesh Babulal" , "surenb@google.com" , yipengxiang Subject: [PATCH v2] cgroup: Fix compilation issue due to cgroup_mutex not being exported Thread-Topic: [PATCH v2] cgroup: Fix compilation issue due to cgroup_mutex not being exported Thread-Index: AduwCdTeMvaUVPv/T2GFTliS72mszA== Date: Fri, 18 Apr 2025 02:42:55 +0000 Message-ID: <5df9200f0e7c4bc586af76e21b380f67@honor.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- v1 -> v2: update the notes of the description above DEFINE_MUTEX(cgroup_mut= ex) 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); =20 -#ifdef CONFIG_PROVE_RCU +#if (defined CONFIG_PROVE_RCU || defined CONFIG_LOCKDEP) EXPORT_SYMBOL_GPL(cgroup_mutex); EXPORT_SYMBOL_GPL(css_set_lock); #endif --=20 2.17.1