Paul Menage wrote: > Add a back-pointer from struct cg_cgroup_link to struct cgroup > > Currently the cgroups code makes the assumption that the subsystem > pointers in a struct css_set uniquely identify the hierarchy->cgroup > mappings associated with the css_set; and there's no way to directly > identify the associated set of cgroups other than by indirecting > through the appropriate subsystem state pointers. > > This patch removes the need for that assumption by adding a > back-pointer from struct cg_cgroup_link object to its associated > cgroup; this allows the set of cgroups to be determined by traversing > the cg_links list in the struct css_set. > > Signed-off-by: Paul Menage <menage@xxxxxxxxxx> > Reviewed-by: Li Zefan <lizf@xxxxxxxxxxxxxx> ... > +#define MAX_TASKS_SHOWN_PER_CSS 25 > +static int cgroup_css_links_read(struct cgroup *cont, > + struct cftype *cft, > + struct seq_file *seq) > +{ > + struct cg_cgroup_link *link; > + I think we need to cgroup_enable_task_cg_lists(): if (!use_task_css_set_links) cgroup_enable_task_cg_lists(); Otherwise we'll see no tasks when reading this debug file if use_task_css_set_links == 0. > + read_lock(&css_set_lock); > + list_for_each_entry(link, &cont->css_sets, cgrp_link_list) { > + struct css_set *cg = link->cg; > + struct task_struct *task; > + int count = 0; > + seq_printf(seq, "css_set %p\n", cg); > + list_for_each_entry(task, &cg->tasks, cg_list) { > + if (count++ > MAX_TASKS_SHOWN_PER_CSS) { > + seq_puts(seq, " ...\n"); > + break; > + } else { > + seq_printf(seq, " task %d\n", > + task_pid_vnr(task)); > + } > + } > + } > + read_unlock(&css_set_lock); > + return 0; > +} _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers