NUMA scheduler issue
Subsystems (4)
Hi,
Very nice patch.
Andrew, would you consider adding this one?
--Shai
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Erich Focht
Sent: Friday, March 26, 2004 00:31
To: Paul Jackson; Xavier Bru
Cc: [email protected]; [email protected]; [email protected]; Erik Jacobson
Subject: Re: [Lse-tech] Re: NUMA scheduler issue
Hi Paul,
Quoted 11 lines · Paul Jackson
Where are you getting the printouts that look like:
initial CPU = 2 cpu 18491 16 cpu0 17125 2 cpu1 441 0 cpu2 700 14 cpu3 225 0 ... current_cpu 0
Quoted 3 lines
We have something in our SGI 2.4 kernels (/proc/<pid>/cpu) that displays this sort of per-cpu usage, but I don't see anything in the 2.6 kernels that seems to do this.
its probably the attached patch. Sorry, I'm travelling and couldn't rediff against a current version...
fs/proc/array.c +23 -0
@@ -405,3 +405,26 @@return sprintf (buffer,"%d %d %d %d %d %d %d\n" , size, resident, shared, text, lib, data,0 ); } + +#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
fs/proc/base.c +10 -0
@@ -56,6 +56,7 @@PROC_PID_STAT ,PROC_PID_STATM ,PROC_PID_MAPS , +PROC_PID_CPU ,PROC_PID_MOUNTS ,PROC_PID_WCHAN , #ifdef CONFIG_SECURITY
@@ -83,6 +84,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 ), +#endifE (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),
@@ -1170,6 +1174,12 @@ inode->i_fop = &proc_info_file_operations; ei->op.proc_read = proc_pid_stat;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_CMDLINE : inode->i_fop = &proc_info_file_operations; ei->op.proc_read = proc_pid_cmdline;
include/linux/sched.h +3 -0
@@ -390,6 +390,9 @@struct list_head posix_timers;/* POSIX.1b Interval Timers */ unsigned long utime, stime, cutime, cstime;u64 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;/* process credentials */
kernel/fork.c +8 -0
@@ -861,6 +861,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 =get_jiffies_64 ();
kernel/timer.c +4 -0
@@ -720,6 +720,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);
Quoted 5 lines · <[email protected]> wrote:
Hi,
Very nice patch.
Andrew, would you consider adding this one?
Not really.
--- 2.6.0-test1-ia64-0/include/linux/sched.h 2003-07-14 05:30:40.000000000 +0200
+++ 2.6.0-test1-ia64-na/include/linux/sched.h 2003-07-18 13:38:02.000000000 +0200
@@ -390,6 +390,9 @@
struct list_head posix_timers; /* POSIX.1b Interval Timers */ unsigned long utime, stime, cutime, cstime;
u64 start_time;
+#ifdef CONFIG_SMP
+ long per_cpu_utime[NR_CPUS], per_cpu_stime[NR_CPUS];
+#endif
On 512p 64-bit that's 8 kilobytes added to the task_struct.