mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 01:21:58 +00:00
cgroup: Add cgroup_subsys->css_rstat_flush()
This patch adds cgroup_subsys->css_rstat_flush(). If a subsystem has this callback, its csses are linked on cgrp->css_rstat_list and rstat will call the function whenever the associated cgroup is flushed. Flush is also performed when such csses are released so that residual counts aren't lost. Combined with the rstat API previous patches factored out, this allows controllers to plug into rstat to manage their statistics in a scalable way. Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
0fa294fb19
commit
8f53470bab
3 changed files with 26 additions and 1 deletions
|
@ -145,8 +145,17 @@ static void cgroup_rstat_flush_locked(struct cgroup *cgrp, bool may_sleep)
|
|||
struct cgroup *pos = NULL;
|
||||
|
||||
raw_spin_lock(cpu_lock);
|
||||
while ((pos = cgroup_rstat_cpu_pop_updated(pos, cgrp, cpu)))
|
||||
while ((pos = cgroup_rstat_cpu_pop_updated(pos, cgrp, cpu))) {
|
||||
struct cgroup_subsys_state *css;
|
||||
|
||||
cgroup_base_stat_flush(pos, cpu);
|
||||
|
||||
rcu_read_lock();
|
||||
list_for_each_entry_rcu(css, &pos->rstat_css_list,
|
||||
rstat_css_node)
|
||||
css->ss->css_rstat_flush(css, cpu);
|
||||
rcu_read_unlock();
|
||||
}
|
||||
raw_spin_unlock(cpu_lock);
|
||||
|
||||
/* if @may_sleep, play nice and yield if necessary */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue