All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Paul Menage <menage@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Containers <containers@lists.linux-foundation.org>
Subject: Re: Re: [PATCH] cgroup(fix critical bug): new handling for tasks file
Date: Mon, 08 Sep 2008 16:19:30 +0800	[thread overview]
Message-ID: <48C4E012.4060400@cn.fujitsu.com> (raw)
In-Reply-To: <48C0C4F7.2080702@google.com>

It's great, Thanks!

	Lai Jiangshan.


Reviewed-by: Lai Jiangshan <laijs@cn.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;
> +		}
> +	}


  parent reply	other threads:[~2008-09-08  8:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-26  1:47 [PATCH] cgroup(fix critical bug): new handling for tasks file Lai Jiangshan
     [not found] ` <48B360CE.2010501-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2008-08-26  2:29   ` Paul Menage
2008-08-26  2:29 ` Paul Menage
2008-08-26  5:22   ` Lai Jiangshan
     [not found]     ` <48B39319.7070403-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2008-08-26 22:40       ` Paul Menage
2008-08-26 22:44       ` Paul Menage
2008-08-26 22:40     ` Paul Menage
2008-08-26 22:44     ` Paul Menage
     [not found]       ` <6599ad830808261544w308a850m865ac0c0a1552c77-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-27  4:29         ` Lai Jiangshan
2008-08-27  4:29       ` Lai Jiangshan
2008-08-27 12:36         ` Paul Menage
2008-08-28 12:09           ` Lai Jiangshan
2008-09-05  5:34             ` Paul Menage
     [not found]               ` <48C0C4F7.2080702-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2008-09-08  8:19                 ` Lai Jiangshan
2008-09-08 21:16                 ` Andrew Morton
2008-09-08  8:19               ` Lai Jiangshan [this message]
2008-09-08 15:42                 ` Paul Menage
     [not found]                 ` <48C4E012.4060400-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2008-09-08 15:42                   ` Paul Menage
2008-09-08 21:16               ` Andrew Morton
2008-09-08 22:05                 ` Paul Menage
     [not found]                 ` <20080908141635.3ce77adc.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2008-09-08 22:05                   ` Paul Menage
     [not found]             ` <48B69582.4000208-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2008-09-05  5:34               ` Paul Menage
     [not found]           ` <6599ad830808270536i353e1807kaac4e9fb74301bb0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-28 12:09             ` Lai Jiangshan
     [not found]         ` <48B4D81D.2040200-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2008-08-27 12:36           ` Paul Menage
     [not found]   ` <6599ad830808251929p10dfc9d2ub11e4db0cd4f9f3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-26  5:22     ` Lai Jiangshan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48C4E012.4060400@cn.fujitsu.com \
    --to=laijs@cn.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=containers@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menage@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.