lkml.org 
[lkml]   [2008]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Re: [PATCH] cgroup(fix critical bug): new handling for tasks file
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;
> + }
> + }



\
 
 \ /
  Last update: 2008-09-08 10:23    [W:0.092 / U:4.344 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site