From c58632b3631cb222da41d9dc0dd39e106c1eafd0 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Thu, 26 Apr 2018 14:29:04 -0700 Subject: cgroup: Rename stat to rstat stat is too generic a name and ends up causing subtle confusions. It'll be made generic so that controllers can plug into it, which will make the problem worse. Let's rename it to something more specific - cgroup_rstat for cgroup recursive stat. This patch does the following renames. No other changes. * cpu_stat -> rstat_cpu * stat -> rstat * ?cstat -> ?rstatc Note that the renames are selective. The unrenamed are the ones which implement basic resource statistics on top of rstat. This will be further cleaned up in the following patches. Signed-off-by: Tejun Heo --- kernel/cgroup/cgroup-internal.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'kernel/cgroup/cgroup-internal.h') diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h index b928b27050c6..092711114a1f 100644 --- a/kernel/cgroup/cgroup-internal.h +++ b/kernel/cgroup/cgroup-internal.h @@ -201,13 +201,13 @@ int cgroup_show_path(struct seq_file *sf, struct kernfs_node *kf_node, int cgroup_task_count(const struct cgroup *cgrp); /* - * stat.c + * rstat.c */ -void cgroup_stat_flush(struct cgroup *cgrp); -int cgroup_stat_init(struct cgroup *cgrp); -void cgroup_stat_exit(struct cgroup *cgrp); +void cgroup_rstat_flush(struct cgroup *cgrp); +int cgroup_rstat_init(struct cgroup *cgrp); +void cgroup_rstat_exit(struct cgroup *cgrp); void cgroup_stat_show_cputime(struct seq_file *seq); -void cgroup_stat_boot(void); +void cgroup_rstat_boot(void); /* * namespace.c -- cgit v1.2.1 From d4ff749b5e0f1e2d4d69a3e4ea81cdeaeb4904d2 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Thu, 26 Apr 2018 14:29:04 -0700 Subject: cgroup: Distinguish base resource stat implementation from rstat Base resource stat accounts universial (not specific to any controller) resource consumptions on top of rstat. Currently, its implementation is intermixed with rstat implementation making the code confusing to follow. This patch clarifies the distintion by doing the followings. * Encapsulate base resource stat counters, currently only cputime, in struct cgroup_base_stat. * Move prev_cputime into struct cgroup and initialize it with cgroup. * Rename the related functions so that they start with cgroup_base_stat. * Prefix the related variables and field names with b. This patch doesn't make any functional changes. Signed-off-by: Tejun Heo --- kernel/cgroup/cgroup-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel/cgroup/cgroup-internal.h') diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h index 092711114a1f..aab4d0a09670 100644 --- a/kernel/cgroup/cgroup-internal.h +++ b/kernel/cgroup/cgroup-internal.h @@ -206,7 +206,7 @@ int cgroup_task_count(const struct cgroup *cgrp); void cgroup_rstat_flush(struct cgroup *cgrp); int cgroup_rstat_init(struct cgroup *cgrp); void cgroup_rstat_exit(struct cgroup *cgrp); -void cgroup_stat_show_cputime(struct seq_file *seq); +void cgroup_base_stat_cputime_show(struct seq_file *seq); void cgroup_rstat_boot(void); /* -- cgit v1.2.1 From a17556f8d9798e8feff9e34d746e489e78ee1dab Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Thu, 26 Apr 2018 14:29:05 -0700 Subject: cgroup: Reorganize kernel/cgroup/rstat.c Currently, rstat.c has rstat and base stat implementations intermixed. Collect base stat implementation at the end of the file. Also, reorder the prototypes. This patch doesn't make any functional changes. Signed-off-by: Tejun Heo --- kernel/cgroup/cgroup-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel/cgroup/cgroup-internal.h') diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h index aab4d0a09670..2bf6fb417588 100644 --- a/kernel/cgroup/cgroup-internal.h +++ b/kernel/cgroup/cgroup-internal.h @@ -206,8 +206,8 @@ int cgroup_task_count(const struct cgroup *cgrp); void cgroup_rstat_flush(struct cgroup *cgrp); int cgroup_rstat_init(struct cgroup *cgrp); void cgroup_rstat_exit(struct cgroup *cgrp); -void cgroup_base_stat_cputime_show(struct seq_file *seq); void cgroup_rstat_boot(void); +void cgroup_base_stat_cputime_show(struct seq_file *seq); /* * namespace.c -- cgit v1.2.1 From 6162cef0f741c70eb0c7ac7e6142f85808d8abc4 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Thu, 26 Apr 2018 14:29:05 -0700 Subject: cgroup: Factor out and expose cgroup_rstat_*() interface functions cgroup_rstat is being generalized so that controllers can use it too. This patch factors out and exposes the following interface functions. * cgroup_rstat_updated(): Renamed from cgroup_rstat_cpu_updated() for consistency. * cgroup_rstat_flush_hold/release(): Factored out from base stat implementation. * cgroup_rstat_flush(): Verbatim expose. While at it, drop assert on cgroup_rstat_mutex in cgroup_base_stat_flush() as it crosses layers and make a minor comment update. v2: Added EXPORT_SYMBOL_GPL(cgroup_rstat_updated) to fix a build bug. Signed-off-by: Tejun Heo --- kernel/cgroup/cgroup-internal.h | 1 - 1 file changed, 1 deletion(-) (limited to 'kernel/cgroup/cgroup-internal.h') diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h index 2bf6fb417588..b68e1a7c146c 100644 --- a/kernel/cgroup/cgroup-internal.h +++ b/kernel/cgroup/cgroup-internal.h @@ -203,7 +203,6 @@ int cgroup_task_count(const struct cgroup *cgrp); /* * rstat.c */ -void cgroup_rstat_flush(struct cgroup *cgrp); int cgroup_rstat_init(struct cgroup *cgrp); void cgroup_rstat_exit(struct cgroup *cgrp); void cgroup_rstat_boot(void); -- cgit v1.2.1