This commit was manufactured by cvs2svn to create tag 'before-xenU'.
[linux-2.6.git] / fs / proc / proc_misc.c
index 89d0900..6264575 100644 (file)
 #include <linux/jiffies.h>
 #include <linux/sysrq.h>
 #include <linux/vmalloc.h>
+#include <linux/crash_dump.h>
+#include <linux/vs_base.h>
+#include <linux/vs_cvirt.h>
+
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
@@ -51,6 +55,8 @@
 #include <asm/div64.h>
 #include "internal.h"
 
+#include <linux/vs_cvirt.h>
+
 #define LOAD_INT(x) ((x) >> FSHIFT)
 #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
 /*
@@ -81,17 +87,32 @@ static int proc_calc_metrics(char *page, char **start, off_t off,
 static int loadavg_read_proc(char *page, char **start, off_t off,
                                 int count, int *eof, void *data)
 {
+       unsigned int running, threads;
        int a, b, c;
        int len;
 
-       a = avenrun[0] + (FIXED_1/200);
-       b = avenrun[1] + (FIXED_1/200);
-       c = avenrun[2] + (FIXED_1/200);
-       len = sprintf(page,"%d.%02d %d.%02d %d.%02d %ld/%d %d\n",
+       if (vx_flags(VXF_VIRT_LOAD, 0)) {
+               struct vx_info *vxi = current->vx_info;
+
+               a = vxi->cvirt.load[0] + (FIXED_1/200);
+               b = vxi->cvirt.load[1] + (FIXED_1/200);
+               c = vxi->cvirt.load[2] + (FIXED_1/200);
+
+               running = atomic_read(&vxi->cvirt.nr_running);
+               threads = atomic_read(&vxi->cvirt.nr_threads);
+       } else {
+               a = avenrun[0] + (FIXED_1/200);
+               b = avenrun[1] + (FIXED_1/200);
+               c = avenrun[2] + (FIXED_1/200);
+
+               running = nr_running();
+               threads = nr_threads;
+       }
+       len = sprintf(page,"%d.%02d %d.%02d %d.%02d %d/%d %d\n",
                LOAD_INT(a), LOAD_FRAC(a),
                LOAD_INT(b), LOAD_FRAC(b),
                LOAD_INT(c), LOAD_FRAC(c),
-               nr_running(), nr_threads, last_pid);
+               running, threads, last_pid);
        return proc_calc_metrics(page, start, off, count, eof, len);
 }
 
@@ -105,6 +126,9 @@ static int uptime_read_proc(char *page, char **start, off_t off,
 
        do_posix_clock_monotonic_gettime(&uptime);
        cputime_to_timespec(idletime, &idle);
+       if (vx_flags(VXF_VIRT_UPTIME, 0))
+               vx_vsi_uptime(&uptime, &idle);
+
        len = sprintf(page,"%lu.%02lu %lu.%02lu\n",
                        (unsigned long) uptime.tv_sec,
                        (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
@@ -126,6 +150,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
        unsigned long committed;
        unsigned long allowed;
        struct vmalloc_info vmi;
+       long cached;
 
        get_page_state(&ps);
        get_zone_counts(&active, &inactive, &free);
@@ -140,6 +165,10 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
        allowed = ((totalram_pages - hugetlb_total_pages())
                * sysctl_overcommit_ratio / 100) + total_swap_pages;
 
+       cached = get_page_cache_size() - total_swapcache_pages - i.bufferram;
+       if (cached < 0)
+               cached = 0;
+
        get_vmalloc_info(&vmi);
 
        /*
@@ -172,7 +201,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
                K(i.totalram),
                K(i.freeram),
                K(i.bufferram),
-               K(get_page_cache_size()-total_swapcache_pages-i.bufferram),
+               K(cached),
                K(total_swapcache_pages),
                K(active),
                K(inactive),
@@ -189,7 +218,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
                K(allowed),
                K(committed),
                K(ps.nr_page_table_pages),
-               VMALLOC_TOTAL >> 10,
+               (unsigned long)VMALLOC_TOTAL >> 10,
                vmi.used >> 10,
                vmi.largest_chunk >> 10
                );
@@ -219,8 +248,9 @@ static int version_read_proc(char *page, char **start, off_t off,
 {
        int len;
 
-       strcpy(page, linux_banner);
-       len = strlen(page);
+       len = sprintf(page, vx_linux_banner,
+               vx_new_uts(release),
+               vx_new_uts(version));
        return proc_calc_metrics(page, start, off, count, eof, len);
 }
 
@@ -524,7 +554,7 @@ static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
 
                if (get_user(c, buf))
                        return -EFAULT;
-               __handle_sysrq(c, NULL, NULL);
+               __handle_sysrq(c, NULL, NULL, 0);
        }
        return count;
 }
@@ -599,11 +629,13 @@ void __init proc_misc_init(void)
                                (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
        }
 #endif
+       crash_create_proc_entry();
 #ifdef CONFIG_MAGIC_SYSRQ
        entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL);
        if (entry)
                entry->proc_fops = &proc_sysrq_trigger_operations;
 #endif
+       crash_enable_by_proc();
 #ifdef CONFIG_PPC32
        {
                extern struct file_operations ppc_htab_operations;