mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 10:19:26 +00:00
Update vm zone list traversal for changes made to kernel. Note that this
is ultimately silly because no locks are held in user space while traversing the list via kvm_reads... really, this should use the sysctl interface which *is* protected by a lock in the kernel.
This commit is contained in:
parent
6d84d742df
commit
97ace1c6ac
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=71402
@ -866,6 +866,7 @@ domem()
|
||||
void
|
||||
dozmem()
|
||||
{
|
||||
static SLIST_HEAD(vm_zone_list, vm_zone) zlist;
|
||||
vm_zone_t zonep;
|
||||
int nmax = 512;
|
||||
int zused_bytes = 0;
|
||||
@ -880,7 +881,10 @@ dozmem()
|
||||
"mem-use"
|
||||
);
|
||||
|
||||
kread(X_ZLIST, &zonep, sizeof(zonep));
|
||||
SLIST_INIT(&zlist);
|
||||
kread(X_ZLIST, &zlist, sizeof(zlist));
|
||||
zonep = SLIST_FIRST(&zlist);
|
||||
|
||||
while (zonep != NULL && nmax) {
|
||||
struct vm_zone zone;
|
||||
char buf[32];
|
||||
@ -904,7 +908,7 @@ dozmem()
|
||||
zused_bytes += (zone.ztotal - zone.zfreecnt) * zone.zsize;
|
||||
ztotal_bytes += zone.ztotal * zone.zsize;
|
||||
--nmax;
|
||||
zonep = zone.znext;
|
||||
zonep = SLIST_NEXT(&zone, zent);
|
||||
}
|
||||
printf(
|
||||
"------------------------------------------\n"
|
||||
|
Loading…
Reference in New Issue
Block a user