Commit 050aa593 authored by Doug Ledford's avatar Doug Ledford

Merge bk://linux.bkbits.net/linux-2.5

into compaq.xsintricity.com:/home/dledford/bk/linux-2.5-wo-timeval
parents dd14119a 6e6d7674
...@@ -362,7 +362,7 @@ static int kstat_read_proc(char *page, char **start, off_t off, ...@@ -362,7 +362,7 @@ static int kstat_read_proc(char *page, char **start, off_t off,
int i, len; int i, len;
extern unsigned long total_forks; extern unsigned long total_forks;
u64 jif; u64 jif;
unsigned int sum = 0, user = 0, nice = 0, system = 0, idle = 0, iowait = 0; unsigned int sum = 0, user = 0, nice = 0, system = 0, idle = 0, iowait = 0, irq = 0, softirq = 0;
struct timeval now; struct timeval now;
unsigned long seq; unsigned long seq;
...@@ -388,25 +388,31 @@ static int kstat_read_proc(char *page, char **start, off_t off, ...@@ -388,25 +388,31 @@ static int kstat_read_proc(char *page, char **start, off_t off,
system += kstat_cpu(i).cpustat.system; system += kstat_cpu(i).cpustat.system;
idle += kstat_cpu(i).cpustat.idle; idle += kstat_cpu(i).cpustat.idle;
iowait += kstat_cpu(i).cpustat.iowait; iowait += kstat_cpu(i).cpustat.iowait;
irq += kstat_cpu(i).cpustat.irq;
softirq += kstat_cpu(i).cpustat.softirq;
for (j = 0 ; j < NR_IRQS ; j++) for (j = 0 ; j < NR_IRQS ; j++)
sum += kstat_cpu(i).irqs[j]; sum += kstat_cpu(i).irqs[j];
} }
len = sprintf(page, "cpu %u %u %u %u %u\n", len = sprintf(page, "cpu %u %u %u %u %u %u %u\n",
jiffies_to_clock_t(user), jiffies_to_clock_t(user),
jiffies_to_clock_t(nice), jiffies_to_clock_t(nice),
jiffies_to_clock_t(system), jiffies_to_clock_t(system),
jiffies_to_clock_t(idle), jiffies_to_clock_t(idle),
jiffies_to_clock_t(iowait)); jiffies_to_clock_t(iowait),
jiffies_to_clock_t(irq),
jiffies_to_clock_t(softirq));
for (i = 0 ; i < NR_CPUS; i++){ for (i = 0 ; i < NR_CPUS; i++){
if (!cpu_online(i)) continue; if (!cpu_online(i)) continue;
len += sprintf(page + len, "cpu%d %u %u %u %u %u\n", len += sprintf(page + len, "cpu%d %u %u %u %u %u %u %u\n",
i, i,
jiffies_to_clock_t(kstat_cpu(i).cpustat.user), jiffies_to_clock_t(kstat_cpu(i).cpustat.user),
jiffies_to_clock_t(kstat_cpu(i).cpustat.nice), jiffies_to_clock_t(kstat_cpu(i).cpustat.nice),
jiffies_to_clock_t(kstat_cpu(i).cpustat.system), jiffies_to_clock_t(kstat_cpu(i).cpustat.system),
jiffies_to_clock_t(kstat_cpu(i).cpustat.idle), jiffies_to_clock_t(kstat_cpu(i).cpustat.idle),
jiffies_to_clock_t(kstat_cpu(i).cpustat.iowait)); jiffies_to_clock_t(kstat_cpu(i).cpustat.iowait),
jiffies_to_clock_t(kstat_cpu(i).cpustat.irq),
jiffies_to_clock_t(kstat_cpu(i).cpustat.softirq));
} }
len += sprintf(page + len, "intr %u", sum); len += sprintf(page + len, "intr %u", sum);
......
...@@ -17,6 +17,8 @@ struct cpu_usage_stat { ...@@ -17,6 +17,8 @@ struct cpu_usage_stat {
unsigned int user; unsigned int user;
unsigned int nice; unsigned int nice;
unsigned int system; unsigned int system;
unsigned int softirq;
unsigned int irq;
unsigned int idle; unsigned int idle;
unsigned int iowait; unsigned int iowait;
}; };
......
...@@ -34,4 +34,14 @@ ...@@ -34,4 +34,14 @@
# define PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */ # define PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */
# define PR_FP_EXC_PRECISE 3 /* precise exception mode */ # define PR_FP_EXC_PRECISE 3 /* precise exception mode */
/* Get/set whether we use statistical process timing or accurate timestamp
* based process timing */
#define PR_GET_TIMING 13
#define PR_SET_TIMING 14
# define PR_TIMING_STATISTICAL 0 /* Normal, traditional,
statistical process timing */
# define PR_TIMING_TIMESTAMP 1 /* Accurate timestamp based
process timing */
#endif /* _LINUX_PRCTL_H */ #endif /* _LINUX_PRCTL_H */
...@@ -1201,11 +1201,17 @@ void scheduler_tick(int user_ticks, int sys_ticks) ...@@ -1201,11 +1201,17 @@ void scheduler_tick(int user_ticks, int sys_ticks)
if (rcu_pending(cpu)) if (rcu_pending(cpu))
rcu_check_callbacks(cpu, user_ticks); rcu_check_callbacks(cpu, user_ticks);
/* note: this timer irq context must be accounted for as well */
if (hardirq_count() - HARDIRQ_OFFSET) {
cpustat->irq += sys_ticks;
sys_ticks = 0;
} else if (softirq_count()) {
cpustat->softirq += sys_ticks;
sys_ticks = 0;
}
if (p == rq->idle) { if (p == rq->idle) {
/* note: this timer irq context must be accounted for as well */ if (atomic_read(&rq->nr_iowait) > 0)
if (irq_count() - HARDIRQ_OFFSET >= SOFTIRQ_OFFSET)
cpustat->system += sys_ticks;
else if (atomic_read(&rq->nr_iowait) > 0)
cpustat->iowait += sys_ticks; cpustat->iowait += sys_ticks;
else else
cpustat->idle += sys_ticks; cpustat->idle += sys_ticks;
......
...@@ -1399,7 +1399,15 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, ...@@ -1399,7 +1399,15 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
case PR_GET_FPEXC: case PR_GET_FPEXC:
error = GET_FPEXC_CTL(current, arg2); error = GET_FPEXC_CTL(current, arg2);
break; break;
case PR_GET_TIMING:
error = PR_TIMING_STATISTICAL;
break;
case PR_SET_TIMING:
if (arg2 == PR_TIMING_STATISTICAL)
error = 0;
else
error = -EINVAL;
break;
case PR_GET_KEEPCAPS: case PR_GET_KEEPCAPS:
if (current->keep_capabilities) if (current->keep_capabilities)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment