svn commit: r305856 - head/sys/compat/linprocfs
Mateusz Guzik
mjg at FreeBSD.org
Fri Sep 16 03:36:44 UTC 2016
Author: mjg
Date: Fri Sep 16 03:36:43 2016
New Revision: 305856
URL: https://svnweb.freebsd.org/changeset/base/305856
Log:
linprocfs: garbage collect meminfo fields not present in linux
In particular memshared not only does not exist in linux, it was
extremely expensive to calculate.
Modified:
head/sys/compat/linprocfs/linprocfs.c
Modified: head/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- head/sys/compat/linprocfs/linprocfs.c Fri Sep 16 03:04:48 2016 (r305855)
+++ head/sys/compat/linprocfs/linprocfs.c Fri Sep 16 03:36:43 2016 (r305856)
@@ -144,12 +144,10 @@ linprocfs_domeminfo(PFS_FILL_ARGS)
unsigned long memtotal; /* total memory in bytes */
unsigned long memused; /* used memory in bytes */
unsigned long memfree; /* free memory in bytes */
- unsigned long memshared; /* shared memory ??? */
unsigned long buffers, cached; /* buffer / cache memory ??? */
unsigned long long swaptotal; /* total swap space in bytes */
unsigned long long swapused; /* used swap space in bytes */
unsigned long long swapfree; /* free swap space in bytes */
- vm_object_t object;
int i, j;
memtotal = physmem * PAGE_SIZE;
@@ -169,13 +167,6 @@ linprocfs_domeminfo(PFS_FILL_ARGS)
swaptotal = (unsigned long long)i * PAGE_SIZE;
swapused = (unsigned long long)j * PAGE_SIZE;
swapfree = swaptotal - swapused;
- memshared = 0;
- mtx_lock(&vm_object_list_mtx);
- TAILQ_FOREACH(object, &vm_object_list, object_list)
- if (object->shadow_count > 1)
- memshared += object->resident_page_count;
- mtx_unlock(&vm_object_list_mtx);
- memshared *= PAGE_SIZE;
/*
* We'd love to be able to write:
*
@@ -188,21 +179,14 @@ linprocfs_domeminfo(PFS_FILL_ARGS)
cached = vm_cnt.v_cache_count * PAGE_SIZE;
sbuf_printf(sb,
- " total: used: free: shared: buffers: cached:\n"
- "Mem: %lu %lu %lu %lu %lu %lu\n"
- "Swap: %llu %llu %llu\n"
"MemTotal: %9lu kB\n"
"MemFree: %9lu kB\n"
- "MemShared:%9lu kB\n"
"Buffers: %9lu kB\n"
"Cached: %9lu kB\n"
"SwapTotal:%9llu kB\n"
"SwapFree: %9llu kB\n",
- memtotal, memused, memfree, memshared, buffers, cached,
- swaptotal, swapused, swapfree,
- B2K(memtotal), B2K(memfree),
- B2K(memshared), B2K(buffers), B2K(cached),
- B2K(swaptotal), B2K(swapfree));
+ B2K(memtotal), B2K(memfree), B2K(buffers),
+ B2K(cached), B2K(swaptotal), B2K(swapfree));
return (0);
}
More information about the svn-src-all
mailing list