Skip to contentSkip to conversation

cgroup/misc: Remove unused misc_cg_res_total_usage

PATCH Applied [email protected] 3 participants 3 messages Jan 27, 2025 – Jan 28, 2025 cgroup

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cgroup/misc: Remove unused misc_cg_res_total_usage

From: "Dr. David Alan Gilbert" <[email protected]>

misc_cg_res_total_usage() was added in 2021 by commit a72232eabdfc ("cgroup: Add misc cgroup controller")

but has remained unused.

Remove it.

---
 include/linux/misc_cgroup.h |  6 ------
 kernel/cgroup/misc.c        | 16 ----------------
 2 files changed, 22 deletions(-)
include/linux/misc_cgroup.h +0 -6
index 49eef10c8e59..4bf261d41a6d 100644
@@ -60,7 +60,6 @@ struct misc_cg {
 	struct misc_res res[MISC_CG_RES_TYPES];
 };
 
-u64 misc_cg_res_total_usage(enum misc_res_type type);
 int misc_cg_set_capacity(enum misc_res_type type, u64 capacity);
 int misc_cg_try_charge(enum misc_res_type type, struct misc_cg *cg, u64 amount);
 void misc_cg_uncharge(enum misc_res_type type, struct misc_cg *cg, u64 amount);
@@ -104,11 +103,6 @@ static inline void put_misc_cg(struct misc_cg *cg)
 
 #else /* !CONFIG_CGROUP_MISC */
 
-static inline u64 misc_cg_res_total_usage(enum misc_res_type type)
-{
-	return 0;
-}
-
 static inline int misc_cg_set_capacity(enum misc_res_type type, u64 capacity)
 {
 	return 0;
kernel/cgroup/misc.c +0 -16
index 0e26068995a6..2fa3a4fb2aaf 100644
@@ -67,22 +67,6 @@ static inline bool valid_type(enum misc_res_type type)
 	return type >= 0 && type < MISC_CG_RES_TYPES;
 }
 
-/**
- * misc_cg_res_total_usage() - Get the current total usage of the resource.
- * @type: misc res type.
- *
- * Context: Any context.
- * Return: Current total usage of the resource.
- */
-u64 misc_cg_res_total_usage(enum misc_res_type type)
-{
-	if (valid_type(type))
-		return atomic64_read(&root_cg.res[type].usage);
-
-	return 0;
-}
-EXPORT_SYMBOL_GPL(misc_cg_res_total_usage);
-
 /**
  * misc_cg_set_capacity() - Set the capacity of the misc cgroup res.
  * @type: Type of the misc res.
Signature · 1 line
2.48.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Mon, Jan 27, 2025 at 11:52:14PM +0000, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

misc_cg_res_total_usage() was added in 2021 by commit a72232eabdfc ("cgroup: Add misc cgroup controller")

but has remained unused.

It can be used by out-of-tree modules in theory.
But the information is more likely used by userspace than internal consumers as of
e973dfe929944 ("cgroup/misc: Expose misc.current on cgroup v2 root") v6.5-rc1~187^2~1

Quoted 1 line

Remove it.

I think it's fine to remove it now.

Michal