]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/proc/proc_misc.c
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds
[linux-2.6-omap-h63xx.git] / fs / proc / proc_misc.c
index 75ec6523d29aeb746d51bbce79b178c0e8015e11..bee251cb87c8c42c3d051ec2ea53df209e422c52 100644 (file)
@@ -35,7 +35,6 @@
 #include <linux/signal.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/smp_lock.h>
 #include <linux/seq_file.h>
 #include <linux/times.h>
 #include <linux/profile.h>
@@ -106,6 +105,7 @@ static int uptime_read_proc(char *page, char **start, off_t off,
        cputime_t idletime = cputime_add(init_task.utime, init_task.stime);
 
        do_posix_clock_monotonic_gettime(&uptime);
+       monotonic_to_bootbased(&uptime);
        cputime_to_timespec(idletime, &idle);
        len = sprintf(page,"%lu.%02lu %lu.%02lu\n",
                        (unsigned long) uptime.tv_sec,
@@ -429,18 +429,11 @@ static int slabstats_open(struct inode *inode, struct file *file)
        return ret;
 }
 
-static int slabstats_release(struct inode *inode, struct file *file)
-{
-       struct seq_file *m = file->private_data;
-       kfree(m->private);
-       return seq_release(inode, file);
-}
-
 static const struct file_operations proc_slabstats_operations = {
        .open           = slabstats_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = slabstats_release,
+       .release        = seq_release_private,
 };
 #endif
 #endif
@@ -451,12 +444,17 @@ static int show_stat(struct seq_file *p, void *v)
        unsigned long jif;
        cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
        u64 sum = 0;
+       struct timespec boottime;
+       unsigned int *per_irq_sum;
+
+       per_irq_sum = kzalloc(sizeof(unsigned int)*NR_IRQS, GFP_KERNEL);
+       if (!per_irq_sum)
+               return -ENOMEM;
 
        user = nice = system = idle = iowait =
                irq = softirq = steal = cputime64_zero;
-       jif = - wall_to_monotonic.tv_sec;
-       if (wall_to_monotonic.tv_nsec)
-               --jif;
+       getboottime(&boottime);
+       jif = boottime.tv_sec;
 
        for_each_possible_cpu(i) {
                int j;
@@ -469,8 +467,11 @@ static int show_stat(struct seq_file *p, void *v)
                irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq);
                softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
                steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
-               for (j = 0 ; j < NR_IRQS ; j++)
-                       sum += kstat_cpu(i).irqs[j];
+               for (j = 0; j < NR_IRQS; j++) {
+                       unsigned int temp = kstat_cpu(i).irqs[j];
+                       sum += temp;
+                       per_irq_sum[j] += temp;
+               }
        }
 
        seq_printf(p, "cpu  %llu %llu %llu %llu %llu %llu %llu %llu\n",
@@ -506,9 +507,10 @@ static int show_stat(struct seq_file *p, void *v)
        }
        seq_printf(p, "intr %llu", (unsigned long long)sum);
 
-#if !defined(CONFIG_PPC64) && !defined(CONFIG_ALPHA) && !defined(CONFIG_IA64)
+#ifndef CONFIG_SMP
+       /* Touches too many cache lines on SMP setups */
        for (i = 0; i < NR_IRQS; i++)
-               seq_printf(p, " %u", kstat_irqs(i));
+               seq_printf(p, " %u", per_irq_sum[i]);
 #endif
 
        seq_printf(p,
@@ -523,6 +525,7 @@ static int show_stat(struct seq_file *p, void *v)
                nr_running(),
                nr_iowait());
 
+       kfree(per_irq_sum);
        return 0;
 }