William Lee Irwin III <[EMAIL PROTECTED]> wrote:
>
>       switch (who) {
> +             case RUSAGE_THREAD:
> +                     utime = p->utime;
> +                     stime = p->stime;
> +                     r->ru_nvcsw = p->nvcsw;
> +                     r->ru_nivcsw = p->nivcsw;
> +                     r->ru_minflt = p->min_flt;
> +                     r->ru_majflt = p->maj_flt;
> +                     r->ru_inblock = task_io_get_inblock(p);
> +                     r->ru_oublock = task_io_get_oublock(p);
> +                     break;

Minor nit. Perhaps it makes sense to introduce

        static void rusage_self(struct rusage *r, struct task_struct *p);

for that. Could be re-used by "do {} while ()" below. Of course, we need
s/=/+=/.

Or, if we think the kernel code is too much clean,

        --- kernel/sys.c~       2007-04-05 12:20:35.000000000 +0400
        +++ kernel/sys.c        2007-04-11 00:08:53.000000000 +0400
        @@ -2097,6 +2097,7 @@ static void k_getrusage(struct task_stru
                                r->ru_majflt += p->signal->maj_flt;
                                r->ru_inblock += p->signal->inblock;
                                r->ru_oublock += p->signal->oublock;
        +               case RUSAGE_THREAD:
                                t = p;
                                do {
                                        utime = cputime_add(utime, t->utime);
        @@ -2107,7 +2108,9 @@ static void k_getrusage(struct task_stru
                                        r->ru_majflt += t->maj_flt;
                                        r->ru_inblock += task_io_get_inblock(t);
                                        r->ru_oublock += task_io_get_oublock(t);
        -                               t = next_thread(t);
        +
        +                               if (who != RUSAGE_THREAD)
        +                                       t = next_thread(t);
                                } while (t != p);
                                break;
         

Oleg.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to