@@ -651,6 +651,7 @@ struct cgroup_subsys {
int (*css_extra_stat_show)(struct seq_file *seq,
struct cgroup_subsys_state *css);
+ void (*css_top)(struct cgroup_subsys_state *css, struct seq_file *seq);
int (*can_attach)(struct cgroup_taskset *tset);
void (*cancel_attach)(struct cgroup_taskset *tset);
void (*attach)(struct cgroup_taskset *tset);
@@ -3867,6 +3867,22 @@ static ssize_t cgroup_kill_write(struct kernfs_open_file *of, char *buf,
return ret ?: nbytes;
}
+static int cgroup_top_show(struct seq_file *seq, void *v)
+{
+ struct cgroup *cgrp = seq_css(seq)->cgroup;
+ struct cgroup_subsys_state *css;
+ int ssid;
+
+ rcu_read_lock();
+ for_each_css(css, ssid, cgrp) {
+ if (css->ss->css_top)
+ css->ss->css_top(css, seq);
+ }
+ rcu_read_unlock();
+
+ return 0;
+}
+
static int cgroup_file_open(struct kernfs_open_file *of)
{
struct cftype *cft = of_cft(of);
@@ -5125,6 +5141,10 @@ static struct cftype cgroup_base_files[] = {
.release = cgroup_pressure_release,
},
#endif /* CONFIG_PSI */
+ {
+ .name = "cgroup.top",
+ .seq_show = cgroup_top_show,
+ },
{ } /* terminate */
};