lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed, 11 Apr 2007 00:10:36 +0400
From:	Oleg Nesterov <oleg@...sign.ru>
To:	wli@...omorphy.com
Cc:	Eric Dumazet <dada1@...mosbay.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: per-thread rusage

William Lee Irwin III <wli@...omorphy.com> 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 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

Powered by Openwall GNU/*/Linux Powered by OpenVZ