This patch is from: Egor Martsenyuk Virtualize /proc/meminfo output. total mem = vmguarpages.limit, swap + ram = privvmpages.limit . usedram = physpages.held --- linux-2.6.8-openvz-022.076bkp/fs/proc/proc_misc.c 2006-05-02 11:48:11.000000000 +0300 +++ linux-2.6.8-openvz-022.076/fs/proc/proc_misc.c 2006-05-03 15:36:33.000000000 +0300 @@ -54,6 +54,10 @@ #include #include +#include +#include +#include + /* * Warning: stuff below (imported functions) assumes that its output will fit * into one page. For some of those functions it may be wrong. Moreover, we @@ -184,6 +188,20 @@ static int meminfo_read_proc(char *page, unsigned long dummy; struct vmalloc_info vmi; +/* + * get open_vz data of mem + * + */ + struct user_beancounter *ub; + + + ub = current->mm->mm_ub; + +/* + * end get open_vz data of mem + * + */ get_page_state(&mi.ps); get_zone_counts(&mi.active, &mi.inactive, &dummy); @@ -211,6 +229,9 @@ static int meminfo_read_proc(char *page, /* * Tagged format, for easy grepping and expansion. */ + +if(ub->ub_uid == 0) + { len = sprintf(page, "MemTotal: %8lu kB\n" "MemFree: %8lu kB\n" @@ -257,7 +278,56 @@ static int meminfo_read_proc(char *page, K(mi.vmalloc_used), K(mi.vmalloc_largest) ); - + } +else + { + len = sprintf(page, + "MemTotal: %8lu kB\n" + "MemFree: %8lu kB\n" + "Buffers: %8lu kB\n" + "Cached: %8lu kB\n" + "SwapCached: %8lu kB\n" + "Active: %8lu kB\n" + "Inactive: %8lu kB\n" + "HighTotal: %8lu kB\n" + "HighFree: %8lu kB\n" + "LowTotal: %8lu kB\n" + "LowFree: %8lu kB\n" + "SwapTotal: %8lu kB\n" + "SwapFree: %8lu kB\n" + "Dirty: %8lu kB\n" + "Writeback: %8lu kB\n" + "Mapped: %8lu kB\n" + "Slab: %8lu kB\n" + "Committed_AS: %8lu kB\n" + "PageTables: %8lu kB\n" + "VmallocTotal: %8lu kB\n" + "VmallocUsed: %8lu kB\n" + "VmallocChunk: %8lu kB\n", + ub->ub_parms[7].limit*4, + (ub->ub_parms[7].limit - ub->ub_parms[6].held)*4, + 0, + 0, + 0, + K(mi.active), + K(mi.inactive), + K(mi.si.totalhigh), + K(mi.si.freehigh), + K(mi.si.totalram-mi.si.totalhigh), + K(mi.si.freeram-mi.si.freehigh), + (ub->ub_parms[2].limit - ub->ub_parms[7].limit)*4, + (ub->ub_parms[2].limit - ub->ub_parms[7].limit - ub->ub_parms[2].held)*4, + K(mi.ps.nr_dirty), + K(mi.ps.nr_writeback), + K(mi.ps.nr_mapped), + K(mi.ps.nr_slab), + K(mi.committed_space), + ub->ub_parms[2].held*4, + K(mi.vmalloc_total), + K(mi.vmalloc_used), + K(mi.vmalloc_largest) + ); + } #ifdef CONFIG_HUGETLB_PAGE #warning Virtualize hugetlb_report_meminfo #else