[Devel] [PATCH rh7 3/7] ub: export ub_get_{mem,blkio}_css

Vladimir Davydov vdavydov at parallels.com
Tue Jun 9 07:06:44 PDT 2015


I am going to use them outside kernel/bc/beancounter.c, so move them to
include/bc/beancounter.h

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 include/bc/beancounter.h | 15 +++++++++++++++
 kernel/bc/beancounter.c  | 15 +--------------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/include/bc/beancounter.h b/include/bc/beancounter.h
index 2e1e26922230..779a213576a3 100644
--- a/include/bc/beancounter.h
+++ b/include/bc/beancounter.h
@@ -173,6 +173,21 @@ static inline struct user_beancounter *cgroup_ub(struct cgroup *cg)
 			    struct user_beancounter, css);
 }
 
+extern struct cgroup_subsys_state *
+__ub_get_css(struct user_beancounter *ub, int idx);
+
+static inline struct cgroup_subsys_state *
+ub_get_mem_css(struct user_beancounter *ub)
+{
+	return __ub_get_css(ub, UB_MEM_CGROUP);
+}
+
+static inline struct cgroup_subsys_state *
+ub_get_blkio_css(struct user_beancounter *ub)
+{
+	return __ub_get_css(ub, UB_BLKIO_CGROUP);
+}
+
 static inline int ub_barrier_hit(struct user_beancounter *ub, int resource)
 {
 	return ub->ub_parms[resource].held > ub->ub_parms[resource].barrier;
diff --git a/kernel/bc/beancounter.c b/kernel/bc/beancounter.c
index 81f5518d3340..a439404c49d0 100644
--- a/kernel/bc/beancounter.c
+++ b/kernel/bc/beancounter.c
@@ -114,8 +114,7 @@ static void __ub_set_css(struct user_beancounter *ub, int idx,
 		css_put(old_css);
 }
 
-static struct cgroup_subsys_state *
-__ub_get_css(struct user_beancounter *ub, int idx)
+struct cgroup_subsys_state *__ub_get_css(struct user_beancounter *ub, int idx)
 {
 	struct cgroup_subsys_state *css, *root_css;
 	unsigned long flags;
@@ -155,24 +154,12 @@ static void ub_set_mem_css(struct user_beancounter *ub,
 	__ub_set_css(ub, UB_MEM_CGROUP, css);
 }
 
-static inline struct cgroup_subsys_state *
-ub_get_mem_css(struct user_beancounter *ub)
-{
-	return __ub_get_css(ub, UB_MEM_CGROUP);
-}
-
 static void ub_set_blkio_css(struct user_beancounter *ub,
 			     struct cgroup_subsys_state *css)
 {
 	__ub_set_css(ub, UB_BLKIO_CGROUP, css);
 }
 
-static inline struct cgroup_subsys_state *
-ub_get_blkio_css(struct user_beancounter *ub)
-{
-	return __ub_get_css(ub, UB_BLKIO_CGROUP);
-}
-
 /*
  * Used to attach a task to a beancounter in the legacy API.
  */
-- 
2.1.4




More information about the Devel mailing list