[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48C4E012.4060400@cn.fujitsu.com>
Date: Mon, 08 Sep 2008 16:19:30 +0800
From: Lai Jiangshan <laijs@...fujitsu.com>
To: Paul Menage <menage@...gle.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Containers <containers@...ts.linux-foundation.org>
Subject: Re: Re: [PATCH] cgroup(fix critical bug): new handling for tasks
file
It's great, Thanks!
Lai Jiangshan.
Reviewed-by: Lai Jiangshan <laijs@...fujitsu.com>
Paul Menage wrote:
> - allocate an array of single pages rather than a single kmalloc() region
I will send a patch for it in few days.
> +
> +static void *cgroup_tasks_start(struct seq_file *s, loff_t *pos)
> {
> - int cnt = 0;
> - int i;
> + /*
> + * Initially we receive a position value that corresponds to
> + * one more than the last pid shown (or 0 on the first call or
> + * after a seek to the start). Use a binary-search to find the
> + * next pid to display, if any
> + */
> + struct cgroup *cgrp = s->private;
> + int index = 0, pid = *pos;
> + int *iter;
use pid_t instead of int (include other functions)
> +
> + down_read(&cgrp->pids_mutex);
> + if (pid) {
> + int end = cgrp->pids_length;
> + int i;
int i; unused.
> + while (index < end) {
> + int mid = (index + end) / 2;
> + if (cgrp->tasks_pids[mid] == pid) {
> + index = mid;
> + break;
> + } else if (cgrp->tasks_pids[mid] <= pid)
(cgrp->tasks_pids[mid] <= pid) ===> (cgrp->tasks_pids[mid] < pid)
> + index = mid + 1;
> + else
> + end = mid;
> + }
> + }
--
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