diff options
author | alc <alc@FreeBSD.org> | 2004-01-02 19:29:31 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2004-01-02 19:29:31 +0000 |
commit | 7d2f8d32ae1d9bf5def622d91d179ad176d0f683 (patch) | |
tree | 77c97aed5a937b303a52923c95d64df2731c8b87 /sys/compat | |
parent | 5b996ad186db188d424d6f603fe769319bd28bb7 (diff) | |
download | FreeBSD-src-7d2f8d32ae1d9bf5def622d91d179ad176d0f683.zip FreeBSD-src-7d2f8d32ae1d9bf5def622d91d179ad176d0f683.tar.gz |
Lock the traversal of the vm object list. Use TAILQ_FOREACH consistently.
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linprocfs/linprocfs.c | 2 | ||||
-rw-r--r-- | sys/compat/linux/linux_misc.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index dd88146..c02a2e8 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -143,9 +143,11 @@ linprocfs_domeminfo(PFS_FILL_ARGS) swapused = 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: diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 9e61226..9938785 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -145,10 +145,11 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args) sysinfo.freeram = sysinfo.totalram - cnt.v_wire_count * PAGE_SIZE; sysinfo.sharedram = 0; - for (object = TAILQ_FIRST(&vm_object_list); object != NULL; - object = TAILQ_NEXT(object, object_list)) + mtx_lock(&vm_object_list_mtx); + TAILQ_FOREACH(object, &vm_object_list, object_list) if (object->shadow_count > 1) sysinfo.sharedram += object->resident_page_count; + mtx_unlock(&vm_object_list_mtx); sysinfo.sharedram *= PAGE_SIZE; sysinfo.bufferram = 0; |