If a given subsystem is not the base type and does not have a flush func, do not allocate. Signed-off-by: JP Kobryn <inwardvessel@xxxxxxxxx> --- kernel/cgroup/rstat.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c index 03effaaf09a4..4feefa37fa46 100644 --- a/kernel/cgroup/rstat.c +++ b/kernel/cgroup/rstat.c @@ -423,6 +423,9 @@ int cgroup_rstat_init(struct cgroup_subsys_state *css) { int cpu; + if (css->ss && !css->ss->css_rstat_flush) + return 0; + /* the root cgrp css has rstat_cpu preallocated */ if (!css->rstat_cpu) { css->rstat_cpu = alloc_percpu(struct cgroup_rstat_cpu); @@ -445,6 +448,9 @@ void cgroup_rstat_exit(struct cgroup_subsys_state *css) { int cpu; + if (css->ss && !css->ss->css_rstat_flush) + return; + cgroup_rstat_flush(css); /* sanity check */ -- 2.47.1