[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A6806D9.8020004@cn.fujitsu.com>
Date: Thu, 23 Jul 2009 14:44:41 +0800
From: Li Zefan <lizf@...fujitsu.com>
To: Paul Menage <menage@...gle.com>
CC: akpm@...ux-foundation.org, containers@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] Add a back-pointer from struct cg_cgroup_link to
struct cgroup
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@...gle.com>
>
Reviewed-by: Li Zefan <lizf@...fujitsu.com>
...
> +#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;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists