Skip to contentSkip to conversation

cgroup: Drop sock_cgroup_classid() dummy implementation

PATCH Applied Michal Koutný 3 participants 4 messages Jun 3, 2025 cgroup

lore
Share & tools
lore

Michal Koutný

author maintainer
#0 lore raw

PATCH 1/1 cgroup: Drop sock_cgroup_classid() dummy implementation

The semantic of returning 0 is unclear when !CONFIG_CGROUP_NET_CLASSID. Since there are no callers of sock_cgroup_classid() with that config anymore we can undefine the helper at all and enforce all (future) callers to handle cases when !CONFIG_CGROUP_NET_CLASSID.

---
 include/linux/cgroup-defs.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
include/linux/cgroup-defs.h +4 -6
index e61687d5e496d..cd7f093e34cd7 100644
@@ -898,14 +898,12 @@ static inline u16 sock_cgroup_prioidx(const struct sock_cgroup_data *skcd)
 #endif
 }
 
+#ifdef CONFIG_CGROUP_NET_CLASSID
 static inline u32 sock_cgroup_classid(const struct sock_cgroup_data *skcd)
 {
-#ifdef CONFIG_CGROUP_NET_CLASSID
 	return READ_ONCE(skcd->classid);
-#else
-	return 0;
-#endif
 }
+#endif
 
 static inline void sock_cgroup_set_prioidx(struct sock_cgroup_data *skcd,
 					   u16 prioidx)
@@ -915,13 +913,13 @@ static inline void sock_cgroup_set_prioidx(struct sock_cgroup_data *skcd,
 #endif
 }
 
+#ifdef CONFIG_CGROUP_NET_CLASSID
 static inline void sock_cgroup_set_classid(struct sock_cgroup_data *skcd,
 					   u32 classid)
 {
-#ifdef CONFIG_CGROUP_NET_CLASSID
 	WRITE_ONCE(skcd->classid, classid);
-#endif
 }
+#endif
 
 #else	/* CONFIG_SOCK_CGROUP_DATA */
 

base-commit: cd2e103d57e5615f9bb027d772f93b9efd567224

Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Michal Koutný

The semantic of returning 0 is unclear when !CONFIG_CGROUP_NET_CLASSID. Since there are no callers of sock_cgroup_classid() with that config anymore we can undefine the helper at all and enforce all (future) callers to handle cases when !CONFIG_CGROUP_NET_CLASSID.

That statement is correct with the current upstream kernel.

Quoted 46 lines
---
  include/linux/cgroup-defs.h | 10 ++++------
  1 file changed, 4 insertions(+), 6 deletions(-)
include/linux/cgroup-defs.h +4 -6
index e61687d5e496d..cd7f093e34cd7 100644
@@ -898,14 +898,12 @@ static inline u16 sock_cgroup_prioidx(const struct sock_cgroup_data *skcd)
  #endif
  }
 
+#ifdef CONFIG_CGROUP_NET_CLASSID
  static inline u32 sock_cgroup_classid(const struct sock_cgroup_data *skcd)
  {
-#ifdef CONFIG_CGROUP_NET_CLASSID
  	return READ_ONCE(skcd->classid);
-#else
-	return 0;
-#endif
  }
+#endif
 
  static inline void sock_cgroup_set_prioidx(struct sock_cgroup_data *skcd,
  					   u16 prioidx)
@@ -915,13 +913,13 @@ static inline void sock_cgroup_set_prioidx(struct sock_cgroup_data *skcd,
  #endif
  }
 
+#ifdef CONFIG_CGROUP_NET_CLASSID
  static inline void sock_cgroup_set_classid(struct sock_cgroup_data *skcd,
  					   u32 classid)
  {
-#ifdef CONFIG_CGROUP_NET_CLASSID
  	WRITE_ONCE(skcd->classid, classid);
-#endif
  }
+#endif
 
  #else	/* CONFIG_SOCK_CGROUP_DATA */
 

base-commit: cd2e103d57e5615f9bb027d772f93b9efd567224

maintainer Applied
#2 lore raw
In reply to Michal Koutný
Quoted 8 lines · Michal Koutný

The semantic of returning 0 is unclear when !CONFIG_CGROUP_NET_CLASSID. Since there are no callers of sock_cgroup_classid() with that config anymore we can undefine the helper at all and enforce all (future) callers to handle cases when !CONFIG_CGROUP_NET_CLASSID.

Applied to cgroup/for-6.16-fixes.

Thanks.

Signature · 1 line
tejun
maintainer
#3 lore raw
Quoted 11 lines · Tejun Heo
Quoted 8 lines · Michal Koutný

The semantic of returning 0 is unclear when !CONFIG_CGROUP_NET_CLASSID. Since there are no callers of sock_cgroup_classid() with that config anymore we can undefine the helper at all and enforce all (future) callers to handle cases when !CONFIG_CGROUP_NET_CLASSID.

Applied to cgroup/for-6.16-fixes.

Make that for-6.17.

Thanks.

Signature · 1 line
tejun