cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cgroup: Remove unused css_put_many().
@ 2025-08-06  8:04 Julian Sun
  2025-08-06 13:36 ` Waiman Long
  0 siblings, 1 reply; 2+ messages in thread
From: Julian Sun @ 2025-08-06  8:04 UTC (permalink / raw)
  To: cgroups; +Cc: tj, hannes, Julian Sun

Remove css_put_many() as it's never called by any function.

Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
---
 include/linux/cgroup.h        |  1 -
 include/linux/cgroup_refcnt.h | 15 ---------------
 2 files changed, 16 deletions(-)

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index b18fb5fcb38e..2e232eb8c897 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -322,7 +322,6 @@ void css_get_many(struct cgroup_subsys_state *css, unsigned int n);
 bool css_tryget(struct cgroup_subsys_state *css);
 bool css_tryget_online(struct cgroup_subsys_state *css);
 void css_put(struct cgroup_subsys_state *css);
-void css_put_many(struct cgroup_subsys_state *css, unsigned int n);
 #else
 #define CGROUP_REF_FN_ATTRS	static inline
 #define CGROUP_REF_EXPORT(fn)
diff --git a/include/linux/cgroup_refcnt.h b/include/linux/cgroup_refcnt.h
index 2eea0a69ecfc..1cede70a928c 100644
--- a/include/linux/cgroup_refcnt.h
+++ b/include/linux/cgroup_refcnt.h
@@ -79,18 +79,3 @@ void css_put(struct cgroup_subsys_state *css)
 		percpu_ref_put(&css->refcnt);
 }
 CGROUP_REF_EXPORT(css_put)
-
-/**
- * css_put_many - put css references
- * @css: target css
- * @n: number of references to put
- *
- * Put references obtained via css_get() and css_tryget_online().
- */
-CGROUP_REF_FN_ATTRS
-void css_put_many(struct cgroup_subsys_state *css, unsigned int n)
-{
-	if (!(css->flags & CSS_NO_REF))
-		percpu_ref_put_many(&css->refcnt, n);
-}
-CGROUP_REF_EXPORT(css_put_many)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cgroup: Remove unused css_put_many().
  2025-08-06  8:04 [PATCH] cgroup: Remove unused css_put_many() Julian Sun
@ 2025-08-06 13:36 ` Waiman Long
  0 siblings, 0 replies; 2+ messages in thread
From: Waiman Long @ 2025-08-06 13:36 UTC (permalink / raw)
  To: Julian Sun, cgroups; +Cc: tj, hannes, Julian Sun

On 8/6/25 4:04 AM, Julian Sun wrote:
> Remove css_put_many() as it's never called by any function.

It isn't currently used doesn't mean that it will not be used in the 
future. We have css_get_many() that is used in memcontrol.c. For 
symmetry, we should have a corresponding css_put_many(). Also there is 
little cost in keeping this little helper function around.

Cheers,
Longman

>
> Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
> ---
>   include/linux/cgroup.h        |  1 -
>   include/linux/cgroup_refcnt.h | 15 ---------------
>   2 files changed, 16 deletions(-)
>
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index b18fb5fcb38e..2e232eb8c897 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -322,7 +322,6 @@ void css_get_many(struct cgroup_subsys_state *css, unsigned int n);
>   bool css_tryget(struct cgroup_subsys_state *css);
>   bool css_tryget_online(struct cgroup_subsys_state *css);
>   void css_put(struct cgroup_subsys_state *css);
> -void css_put_many(struct cgroup_subsys_state *css, unsigned int n);
>   #else
>   #define CGROUP_REF_FN_ATTRS	static inline
>   #define CGROUP_REF_EXPORT(fn)
> diff --git a/include/linux/cgroup_refcnt.h b/include/linux/cgroup_refcnt.h
> index 2eea0a69ecfc..1cede70a928c 100644
> --- a/include/linux/cgroup_refcnt.h
> +++ b/include/linux/cgroup_refcnt.h
> @@ -79,18 +79,3 @@ void css_put(struct cgroup_subsys_state *css)
>   		percpu_ref_put(&css->refcnt);
>   }
>   CGROUP_REF_EXPORT(css_put)
> -
> -/**
> - * css_put_many - put css references
> - * @css: target css
> - * @n: number of references to put
> - *
> - * Put references obtained via css_get() and css_tryget_online().
> - */
> -CGROUP_REF_FN_ATTRS
> -void css_put_many(struct cgroup_subsys_state *css, unsigned int n)
> -{
> -	if (!(css->flags & CSS_NO_REF))
> -		percpu_ref_put_many(&css->refcnt, n);
> -}
> -CGROUP_REF_EXPORT(css_put_many)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-06 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06  8:04 [PATCH] cgroup: Remove unused css_put_many() Julian Sun
2025-08-06 13:36 ` Waiman Long

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).