]> err.no Git - linux-2.6/blobdiff - fs/proc/proc_misc.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
[linux-2.6] / fs / proc / proc_misc.c
index 75ec6523d29aeb746d51bbce79b178c0e8015e11..5de7f874d95c0fce684261bb52d7e44d1d957271 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>
@@ -67,7 +66,6 @@ extern int get_stram_list(char *);
 extern int get_filesystem_list(char *);
 extern int get_exec_domain_list(char *);
 extern int get_dma_list(char *);
-extern int get_locks_status (char *, char **, off_t, int);
 
 static int proc_calc_metrics(char *page, char **start, off_t off,
                                 int count, int *eof, int len)
@@ -106,6 +104,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,
@@ -230,6 +229,19 @@ static const struct file_operations fragmentation_file_operations = {
        .release        = seq_release,
 };
 
+extern struct seq_operations pagetypeinfo_op;
+static int pagetypeinfo_open(struct inode *inode, struct file *file)
+{
+       return seq_open(file, &pagetypeinfo_op);
+}
+
+static const struct file_operations pagetypeinfo_file_ops = {
+       .open           = pagetypeinfo_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = seq_release,
+};
+
 extern struct seq_operations zoneinfo_op;
 static int zoneinfo_open(struct inode *inode, struct file *file)
 {
@@ -429,18 +441,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
@@ -450,13 +455,20 @@ static int show_stat(struct seq_file *p, void *v)
        int i;
        unsigned long jif;
        cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
+       cputime64_t guest;
        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;
+       guest = cputime64_zero;
+       getboottime(&boottime);
+       jif = boottime.tv_sec;
 
        for_each_possible_cpu(i) {
                int j;
@@ -469,11 +481,15 @@ 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];
+               guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
+               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",
+       seq_printf(p, "cpu  %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
                (unsigned long long)cputime64_to_clock_t(user),
                (unsigned long long)cputime64_to_clock_t(nice),
                (unsigned long long)cputime64_to_clock_t(system),
@@ -481,7 +497,8 @@ static int show_stat(struct seq_file *p, void *v)
                (unsigned long long)cputime64_to_clock_t(iowait),
                (unsigned long long)cputime64_to_clock_t(irq),
                (unsigned long long)cputime64_to_clock_t(softirq),
-               (unsigned long long)cputime64_to_clock_t(steal));
+               (unsigned long long)cputime64_to_clock_t(steal),
+               (unsigned long long)cputime64_to_clock_t(guest));
        for_each_online_cpu(i) {
 
                /* Copy values here to work around gcc-2.95.3, gcc-2.96 */
@@ -493,7 +510,9 @@ static int show_stat(struct seq_file *p, void *v)
                irq = kstat_cpu(i).cpustat.irq;
                softirq = kstat_cpu(i).cpustat.softirq;
                steal = kstat_cpu(i).cpustat.steal;
-               seq_printf(p, "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu\n",
+               guest = kstat_cpu(i).cpustat.guest;
+               seq_printf(p,
+                       "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu\n",
                        i,
                        (unsigned long long)cputime64_to_clock_t(user),
                        (unsigned long long)cputime64_to_clock_t(nice),
@@ -502,13 +521,15 @@ static int show_stat(struct seq_file *p, void *v)
                        (unsigned long long)cputime64_to_clock_t(iowait),
                        (unsigned long long)cputime64_to_clock_t(irq),
                        (unsigned long long)cputime64_to_clock_t(softirq),
-                       (unsigned long long)cputime64_to_clock_t(steal));
+                       (unsigned long long)cputime64_to_clock_t(steal),
+                       (unsigned long long)cputime64_to_clock_t(guest));
        }
        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 +544,7 @@ static int show_stat(struct seq_file *p, void *v)
                nr_running(),
                nr_iowait());
 
+       kfree(per_irq_sum);
        return 0;
 }
 
@@ -614,16 +636,18 @@ static int cmdline_read_proc(char *page, char **start, off_t off,
        return proc_calc_metrics(page, start, off, count, eof, len);
 }
 
-static int locks_read_proc(char *page, char **start, off_t off,
-                                int count, int *eof, void *data)
+static int locks_open(struct inode *inode, struct file *filp)
 {
-       int len = get_locks_status(page, start, off, count);
-
-       if (len < count)
-               *eof = 1;
-       return len;
+       return seq_open(filp, &locks_seq_operations);
 }
 
+static const struct file_operations proc_locks_operations = {
+       .open           = locks_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = seq_release,
+};
+
 static int execdomains_read_proc(char *page, char **start, off_t off,
                                 int count, int *eof, void *data)
 {
@@ -681,7 +705,6 @@ void __init proc_misc_init(void)
 #endif
                {"filesystems", filesystems_read_proc},
                {"cmdline",     cmdline_read_proc},
-               {"locks",       locks_read_proc},
                {"execdomains", execdomains_read_proc},
                {NULL,}
        };
@@ -699,6 +722,7 @@ void __init proc_misc_init(void)
                        entry->proc_fops = &proc_kmsg_operations;
        }
 #endif
+       create_seq_entry("locks", 0, &proc_locks_operations);
        create_seq_entry("devices", 0, &proc_devinfo_operations);
        create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
 #ifdef CONFIG_BLOCK
@@ -713,6 +737,7 @@ void __init proc_misc_init(void)
 #endif
 #endif
        create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations);
+       create_seq_entry("pagetypeinfo", S_IRUGO, &pagetypeinfo_file_ops);
        create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations);
        create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations);
 #ifdef CONFIG_BLOCK