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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 5 Jun 2007 23:38:41 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Maxim Uvarov <muvarov@...mvista.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Shailabh Nagar <nagar@...son.ibm.com>,
	Balbir Singh <balbir@...ibm.com>, Jay Lan <jlan@...r.sgi.com>,
	Jonathan Lim <jlim@....com>
Subject: Re: [PATCH] Performance Stats: Kernel patch

On Tue, 05 Jun 2007 14:43:50 +0000 Maxim Uvarov <muvarov@...mvista.com> wrote:

> Patch makes available to the user the following
> task and process performance statistics:
> 	* Involuntary Context Switches (task_struct->nivcsw)
> 	* Voluntary Context Switches (task_struct->nvcsw)
> 	           
> Statistics information is available from:
> 	1. taskstats interface (Documentation/accounting/)
> 	2. /proc/PID/status (task only).
> 
> This data is useful for detecting hyperactivity
> patterns between processes.
> Signed-off-by: Maxim Uvarov <muvarov@...mvista.com>

Thanks.

Please retain suitable cc's when discussing a patch.  I keep on having to
find your updates on the mailing list, and then adding all the same cc's
when I reply.

Your patch seemed to be against some horridly prehistoric kernel, so I had
a few things to fix up.

I disagree with the term "rates" for these things.  They are counters, not
rates.  Adjustments are below.

We still need to think about whether we missed any other fields.


diff -puN Documentation/accounting/getdelays.c~taskstats-add-context-switch-counters-fix Documentation/accounting/getdelays.c
--- a/Documentation/accounting/getdelays.c~taskstats-add-context-switch-counters-fix
+++ a/Documentation/accounting/getdelays.c
@@ -49,7 +49,7 @@ char name[100];
 int dbg;
 int print_delays;
 int print_io_accounting;
-int print_task_context_switch_rates;
+int print_task_context_switch_counts;
 __u64 stime, utime;
 
 #define PRINTF(fmt, arg...) {			\
@@ -205,7 +205,7 @@ void print_delayacct(struct taskstats *t
 	       "count", "delay total", t->swapin_count, t->swapin_delay_total);
 }
 
-void task_context_switch_rates(struct taskstats *t)
+void task_context_switch_counts(struct taskstats *t)
 {
 	printf("\n\nTask   %15s%15s\n"
 	       "       %15lu%15lu\n",
@@ -259,7 +259,7 @@ int main(int argc, char *argv[])
 			break;
 		case 'q':
 			printf("printing task/process context switch rates\n");
-			print_task_context_switch_rates = 1;
+			print_task_context_switch_counts = 1;
 			break;
 		case 'w':
 			logfile = strdup(optarg);
@@ -402,8 +402,8 @@ int main(int argc, char *argv[])
 							print_delayacct((struct taskstats *) NLA_DATA(na));
 						if (print_io_accounting)
 							print_ioacct((struct taskstats *) NLA_DATA(na));
-						if (print_task_context_switch_rates)
-							task_context_switch_rates((struct taskstats *) NLA_DATA(na));
+						if (print_task_context_switch_counts)
+							task_context_switch_counts((struct taskstats *) NLA_DATA(na));
 						if (fd) {
 							if (write(fd, NLA_DATA(na), na->nla_len) < 0) {
 								err(1,"write error\n");
diff -puN Documentation/accounting/taskstats-struct.txt~taskstats-add-context-switch-counters-fix Documentation/accounting/taskstats-struct.txt
--- a/Documentation/accounting/taskstats-struct.txt~taskstats-add-context-switch-counters-fix
+++ a/Documentation/accounting/taskstats-struct.txt
@@ -22,7 +22,7 @@ There are three different groups of fiel
     /* Extended accounting fields end */
     Their values are collected if CONFIG_TASK_XACCT is set.
 
-4) Per-task and per-thread context switch rates statistics
+4) Per-task and per-thread context switch count statistics
 
 Future extension should add fields to the end of the taskstats struct, and
 should not change the relative position of each field within the struct.
diff -puN fs/proc/array.c~taskstats-add-context-switch-counters-fix fs/proc/array.c
--- a/fs/proc/array.c~taskstats-add-context-switch-counters-fix
+++ a/fs/proc/array.c
@@ -290,7 +290,9 @@ static inline char *task_cap(struct task
 			    cap_t(p->cap_permitted),
 			    cap_t(p->cap_effective));
 }
-static inline char *task_context_switch_rates(struct task_struct *p, char *buffer)
+
+static inline char *task_context_switch_counts(struct task_struct *p,
+						char *buffer)
 {
 	return buffer + sprintf(buffer, "voluntary_ctxt_switches:\t%lu\n"
 			    "nonvoluntary_ctxt_switches:\t%lu\n",
@@ -316,7 +318,7 @@ int proc_pid_status(struct task_struct *
 #if defined(CONFIG_S390)
 	buffer = task_show_regs(task, buffer);
 #endif
-	buffer = task_context_switch_rates(task, buffer);
+	buffer = task_context_switch_counts(task, buffer);
 	return buffer - orig;
 }
 
_

-
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