cgroup: rstat: retrieve current bstat to delta directly
Instead of retrieve current bstat to cur and copy it to delta, let's use delta directly. This saves one copy operation and has the same code convention as propagating delta to parent. Signed-off-by: Wei Yang <richard.weiyang@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
Родитель
4148be7de0
Коммит
95b99f353c
|
@ -315,7 +315,7 @@ static void cgroup_base_stat_flush(struct cgroup *cgrp, int cpu)
|
||||||
{
|
{
|
||||||
struct cgroup_rstat_cpu *rstatc = cgroup_rstat_cpu(cgrp, cpu);
|
struct cgroup_rstat_cpu *rstatc = cgroup_rstat_cpu(cgrp, cpu);
|
||||||
struct cgroup *parent = cgroup_parent(cgrp);
|
struct cgroup *parent = cgroup_parent(cgrp);
|
||||||
struct cgroup_base_stat cur, delta;
|
struct cgroup_base_stat delta;
|
||||||
unsigned seq;
|
unsigned seq;
|
||||||
|
|
||||||
/* Root-level stats are sourced from system-wide CPU stats */
|
/* Root-level stats are sourced from system-wide CPU stats */
|
||||||
|
@ -325,11 +325,10 @@ static void cgroup_base_stat_flush(struct cgroup *cgrp, int cpu)
|
||||||
/* fetch the current per-cpu values */
|
/* fetch the current per-cpu values */
|
||||||
do {
|
do {
|
||||||
seq = __u64_stats_fetch_begin(&rstatc->bsync);
|
seq = __u64_stats_fetch_begin(&rstatc->bsync);
|
||||||
cur = rstatc->bstat;
|
delta = rstatc->bstat;
|
||||||
} while (__u64_stats_fetch_retry(&rstatc->bsync, seq));
|
} while (__u64_stats_fetch_retry(&rstatc->bsync, seq));
|
||||||
|
|
||||||
/* propagate percpu delta to global */
|
/* propagate percpu delta to global */
|
||||||
delta = cur;
|
|
||||||
cgroup_base_stat_sub(&delta, &rstatc->last_bstat);
|
cgroup_base_stat_sub(&delta, &rstatc->last_bstat);
|
||||||
cgroup_base_stat_add(&cgrp->bstat, &delta);
|
cgroup_base_stat_add(&cgrp->bstat, &delta);
|
||||||
cgroup_base_stat_add(&rstatc->last_bstat, &delta);
|
cgroup_base_stat_add(&rstatc->last_bstat, &delta);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче