From: Erich Focht <efocht@ess.nec.de>
To: "Martin J. Bligh" <mbligh@aracnet.com>,
Michael Hohnbaum <hohnbaum@us.ibm.com>
Cc: Robert Love <rml@tech9.net>, Ingo Molnar <mingo@elte.hu>,
Stephen Hemminger <shemminger@osdl.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.5.53] NUMA scheduler (3/3)
Date: Tue, 31 Dec 2002 14:30:48 +0100 [thread overview]
Message-ID: <200212311430.49001.efocht@ess.nec.de> (raw)
In-Reply-To: <200212311429.04382.efocht@ess.nec.de>
[-- Attachment #1: Type: text/plain, Size: 921 bytes --]
... and the third patch ...
On Tuesday 31 December 2002 14:29, Erich Focht wrote:
> Here comes the minimal NUMA scheduler built on top of the O(1) load
> balancer rediffed for 2.5.53 with some changes in the core part. As
> suggested by Michael, I added the cputimes_stat patch, as it is
> absolutely needed for understanding the scheduler behavior.
>
> The three patches:
> 01-numa-sched-core-2.5.53-24.patch: core NUMA scheduler infrastructure
> providing a node aware load_balancer. Cosmetic changes + more comments.
>
> 02-numa-sched-ilb-2.5.53-21.patch: initial load balancing, selects
> least loaded node & CPU at exec().
>
> 03-cputimes_stat-2.5.53.patch: adds back to the kernel per CPU user
> and system time statistics for each process in /proc/PID/cpu. Needed
> for evaluating scheduler behavior and performance of tasks running
> on SMP and NUMA systems.
>
> Regards,
> Erich
[-- Attachment #2: 03-cputimes_stat-2.5.53.patch --]
[-- Type: text/x-diff, Size: 3316 bytes --]
diff -urN a/fs/proc/array.c b/fs/proc/array.c
--- a/fs/proc/array.c 2002-12-24 06:20:36.000000000 +0100
+++ b/fs/proc/array.c 2002-12-31 14:19:15.000000000 +0100
@@ -597,3 +597,26 @@
out:
return retval;
}
+
+#ifdef CONFIG_SMP
+int proc_pid_cpu(struct task_struct *task, char * buffer)
+{
+ int i, len;
+
+ len = sprintf(buffer,
+ "cpu %lu %lu\n",
+ jiffies_to_clock_t(task->utime),
+ jiffies_to_clock_t(task->stime));
+
+ for (i = 0 ; i < NR_CPUS; i++) {
+ if (cpu_online(i))
+ len += sprintf(buffer + len, "cpu%d %lu %lu\n",
+ i,
+ jiffies_to_clock_t(task->per_cpu_utime[i]),
+ jiffies_to_clock_t(task->per_cpu_stime[i]));
+
+ }
+ len += sprintf(buffer + len, "current_cpu %d\n",task_cpu(task));
+ return len;
+}
+#endif
diff -urN a/fs/proc/base.c b/fs/proc/base.c
--- a/fs/proc/base.c 2002-12-24 06:20:39.000000000 +0100
+++ b/fs/proc/base.c 2002-12-31 14:19:15.000000000 +0100
@@ -55,6 +55,7 @@
PROC_PID_STAT,
PROC_PID_STATM,
PROC_PID_MAPS,
+ PROC_PID_CPU,
PROC_PID_MOUNTS,
PROC_PID_WCHAN,
PROC_PID_FD_DIR = 0x8000, /* 0x8000-0xffff */
@@ -75,6 +76,9 @@
E(PROC_PID_CMDLINE, "cmdline", S_IFREG|S_IRUGO),
E(PROC_PID_STAT, "stat", S_IFREG|S_IRUGO),
E(PROC_PID_STATM, "statm", S_IFREG|S_IRUGO),
+#ifdef CONFIG_SMP
+ E(PROC_PID_CPU, "cpu", S_IFREG|S_IRUGO),
+#endif
E(PROC_PID_MAPS, "maps", S_IFREG|S_IRUGO),
E(PROC_PID_MEM, "mem", S_IFREG|S_IRUSR|S_IWUSR),
E(PROC_PID_CWD, "cwd", S_IFLNK|S_IRWXUGO),
@@ -1026,7 +1030,12 @@
case PROC_PID_MAPS:
inode->i_fop = &proc_maps_operations;
break;
-
+#ifdef CONFIG_SMP
+ case PROC_PID_CPU:
+ inode->i_fop = &proc_info_file_operations;
+ ei->op.proc_read = proc_pid_cpu;
+ break;
+#endif
case PROC_PID_MEM:
inode->i_op = &proc_mem_inode_operations;
inode->i_fop = &proc_mem_operations;
diff -urN a/include/linux/sched.h b/include/linux/sched.h
--- a/include/linux/sched.h 2002-12-31 14:17:13.000000000 +0100
+++ b/include/linux/sched.h 2002-12-31 14:19:15.000000000 +0100
@@ -340,6 +340,9 @@
struct timer_list real_timer;
unsigned long utime, stime, cutime, cstime;
unsigned long start_time;
+#ifdef CONFIG_SMP
+ long per_cpu_utime[NR_CPUS], per_cpu_stime[NR_CPUS];
+#endif
/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap;
int swappable:1;
diff -urN a/kernel/fork.c b/kernel/fork.c
--- a/kernel/fork.c 2002-12-24 06:19:35.000000000 +0100
+++ b/kernel/fork.c 2002-12-31 14:19:15.000000000 +0100
@@ -795,6 +795,14 @@
p->tty_old_pgrp = 0;
p->utime = p->stime = 0;
p->cutime = p->cstime = 0;
+#ifdef CONFIG_SMP
+ {
+ int i;
+
+ for(i = 0; i < NR_CPUS; i++)
+ p->per_cpu_utime[i] = p->per_cpu_stime[i] = 0;
+ }
+#endif
p->array = NULL;
p->lock_depth = -1; /* -1 = no lock */
p->start_time = jiffies;
diff -urN a/kernel/timer.c b/kernel/timer.c
--- a/kernel/timer.c 2002-12-24 06:19:51.000000000 +0100
+++ b/kernel/timer.c 2002-12-31 14:19:15.000000000 +0100
@@ -695,6 +695,10 @@
void update_one_process(struct task_struct *p, unsigned long user,
unsigned long system, int cpu)
{
+#ifdef CONFIG_SMP
+ p->per_cpu_utime[cpu] += user;
+ p->per_cpu_stime[cpu] += system;
+#endif
do_process_times(p, user, system);
do_it_virt(p, user);
do_it_prof(p);
next prev parent reply other threads:[~2002-12-31 13:24 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-06 16:34 NUMA scheduler BK tree Erich Focht
2002-11-06 18:10 ` Michael Hohnbaum
2002-11-07 23:05 ` Erich Focht
2002-11-07 23:46 ` Michael Hohnbaum
2002-11-08 16:57 ` Erich Focht
2002-11-11 15:13 ` [PATCH 2.5.47] NUMA scheduler (1/2) Erich Focht
2002-11-11 15:14 ` [PATCH 2.5.47] NUMA scheduler (2/2) Erich Focht
2002-11-12 0:24 ` [PATCH 2.5.47] NUMA scheduler (1/2) Michael Hohnbaum
2002-11-18 19:40 ` NUMA scheduler BK tree Martin J. Bligh
2002-11-19 16:26 ` [PATCH 2.5.48] NUMA scheduler (1/2) Erich Focht
2002-11-19 16:27 ` [PATCH 2.5.48] NUMA scheduler (2/2) Erich Focht
2002-12-02 15:29 ` [PATCH 2.5.50] NUMA scheduler (1/2) Erich Focht
2002-12-02 15:30 ` [PATCH 2.5.50] NUMA scheduler (2/2) Erich Focht
2002-12-06 17:39 ` [PATCH 2.5.50] NUMA scheduler (1/2) Michael Hohnbaum
2002-12-18 16:21 ` [PATCH 2.5.52] " Erich Focht
2002-12-18 16:23 ` [PATCH 2.5.52] NUMA scheduler (2/2) Erich Focht
2002-12-20 14:49 ` [PATCH 2.5.52] NUMA scheduler: cputimes stats Erich Focht
2002-12-20 15:17 ` [PATCH 2.5.52] NUMA scheduler (1/2) Christoph Hellwig
2002-12-20 17:44 ` Erich Focht
2002-12-31 13:29 ` [PATCH 2.5.53] NUMA scheduler (1/3) Erich Focht
2002-12-31 13:29 ` [PATCH 2.5.53] NUMA scheduler (2/3) Erich Focht
2002-12-31 13:30 ` Erich Focht [this message]
2003-01-04 1:58 ` [PATCH 2.5.53] NUMA scheduler (1/3) Michael Hohnbaum
2003-01-05 5:35 ` Martin J. Bligh
2003-01-06 3:58 ` Michael Hohnbaum
2003-01-06 6:07 ` Martin J. Bligh
2003-01-07 2:23 ` Michael Hohnbaum
2003-01-07 11:27 ` Erich Focht
2003-01-07 23:35 ` Michael Hohnbaum
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=200212311430.49001.efocht@ess.nec.de \
--to=efocht@ess.nec.de \
--cc=hohnbaum@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.com \
--cc=mingo@elte.hu \
--cc=rml@tech9.net \
--cc=shemminger@osdl.org \
/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.