[v8,4/9] ve/cgroup: exported '__put_css_set' and wrappers to cgroup.h

Submitted by Valeriy Vdovin on April 16, 2020, 10:06 a.m.

Details

Message ID 1587031593-780388-5-git-send-email-valeriy.vdovin@virtuozzo.com
State New
Series "Make release_agent per-cgroup property. Run release_agent in proper ve."
Headers show

Commit Message

Valeriy Vdovin April 16, 2020, 10:06 a.m.
Signed-off-by: Valeriy Vdovin <valeriy.vdovin@virtuozzo.com>
---
 include/linux/cgroup.h | 20 ++++++++++++++++++++
 kernel/cgroup.c        | 20 +-------------------
 2 files changed, 21 insertions(+), 19 deletions(-)

Patch hide | download patch | download mbox

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 0239518..0a42f93 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -443,6 +443,26 @@  struct css_set {
 };
 
 /*
+ * refcounted get/put for css_set objects
+ */
+extern void __put_css_set(struct css_set *cg, int taskexit);
+
+static inline void get_css_set(struct css_set *cg)
+{
+	atomic_inc(&cg->refcount);
+}
+
+static inline void put_css_set(struct css_set *cg)
+{
+	__put_css_set(cg, 0);
+}
+
+static inline void put_css_set_taskexit(struct css_set *cg)
+{
+	__put_css_set(cg, 1);
+}
+
+/*
  * cgroup_map_cb is an abstract callback API for reporting map-valued
  * control files
  */
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index b3d3c51..42acbb4 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -333,7 +333,7 @@  static unsigned long css_set_hash(struct cgroup_subsys_state *css[])
  * compiled into their kernel but not actually in use */
 static int use_task_css_set_links __read_mostly;
 
-static void __put_css_set(struct css_set *cg, int taskexit)
+void __put_css_set(struct css_set *cg, int taskexit)
 {
 	struct cg_cgroup_link *link;
 	struct cg_cgroup_link *saved_link;
@@ -382,24 +382,6 @@  static void __put_css_set(struct css_set *cg, int taskexit)
 }
 
 /*
- * refcounted get/put for css_set objects
- */
-static inline void get_css_set(struct css_set *cg)
-{
-	atomic_inc(&cg->refcount);
-}
-
-static inline void put_css_set(struct css_set *cg)
-{
-	__put_css_set(cg, 0);
-}
-
-static inline void put_css_set_taskexit(struct css_set *cg)
-{
-	__put_css_set(cg, 1);
-}
-
-/*
  * compare_css_sets - helper function for find_existing_css_set().
  * @cg: candidate css_set being tested
  * @old_cg: existing css_set for a task

Comments

Kirill Tkhai April 16, 2020, 10:59 a.m.
On 16.04.2020 13:06, Valeriy Vdovin wrote:
> Signed-off-by: Valeriy Vdovin <valeriy.vdovin@virtuozzo.com>

Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>

> ---
>  include/linux/cgroup.h | 20 ++++++++++++++++++++
>  kernel/cgroup.c        | 20 +-------------------
>  2 files changed, 21 insertions(+), 19 deletions(-)
> 
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index 0239518..0a42f93 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -443,6 +443,26 @@ struct css_set {
>  };
>  
>  /*
> + * refcounted get/put for css_set objects
> + */
> +extern void __put_css_set(struct css_set *cg, int taskexit);
> +
> +static inline void get_css_set(struct css_set *cg)
> +{
> +	atomic_inc(&cg->refcount);
> +}
> +
> +static inline void put_css_set(struct css_set *cg)
> +{
> +	__put_css_set(cg, 0);
> +}
> +
> +static inline void put_css_set_taskexit(struct css_set *cg)
> +{
> +	__put_css_set(cg, 1);
> +}
> +
> +/*
>   * cgroup_map_cb is an abstract callback API for reporting map-valued
>   * control files
>   */
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index b3d3c51..42acbb4 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -333,7 +333,7 @@ static unsigned long css_set_hash(struct cgroup_subsys_state *css[])
>   * compiled into their kernel but not actually in use */
>  static int use_task_css_set_links __read_mostly;
>  
> -static void __put_css_set(struct css_set *cg, int taskexit)
> +void __put_css_set(struct css_set *cg, int taskexit)
>  {
>  	struct cg_cgroup_link *link;
>  	struct cg_cgroup_link *saved_link;
> @@ -382,24 +382,6 @@ static void __put_css_set(struct css_set *cg, int taskexit)
>  }
>  
>  /*
> - * refcounted get/put for css_set objects
> - */
> -static inline void get_css_set(struct css_set *cg)
> -{
> -	atomic_inc(&cg->refcount);
> -}
> -
> -static inline void put_css_set(struct css_set *cg)
> -{
> -	__put_css_set(cg, 0);
> -}
> -
> -static inline void put_css_set_taskexit(struct css_set *cg)
> -{
> -	__put_css_set(cg, 1);
> -}
> -
> -/*
>   * compare_css_sets - helper function for find_existing_css_set().
>   * @cg: candidate css_set being tested
>   * @old_cg: existing css_set for a task
>