Date: Mon, 15 Jun 2020 03:02:59 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r362189 - stable/12/sys/compat/linux Message-ID: <202006150302.05F32xX6071064@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Mon Jun 15 03:02:59 2020 New Revision: 362189 URL: https://svnweb.freebsd.org/changeset/base/362189 Log: MFC r361945, r362036: Stop computing a "sharedram" value when emulating Linux sysinfo(2). Modified: stable/12/sys/compat/linux/linux_misc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_misc.c ============================================================================== --- stable/12/sys/compat/linux/linux_misc.c Mon Jun 15 03:02:19 2020 (r362188) +++ stable/12/sys/compat/linux/linux_misc.c Mon Jun 15 03:02:59 2020 (r362189) @@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_kern.h> #include <vm/vm_map.h> #include <vm/vm_extern.h> -#include <vm/vm_object.h> #include <vm/swap_pager.h> #ifdef COMPAT_LINUX32 @@ -150,7 +149,6 @@ int linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args) { struct l_sysinfo sysinfo; - vm_object_t object; int i, j; struct timespec ts; @@ -168,14 +166,13 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_ sysinfo.totalram = physmem * PAGE_SIZE; sysinfo.freeram = sysinfo.totalram - vm_wire_count() * PAGE_SIZE; + /* + * sharedram counts pages allocated to named, swap-backed objects such + * as shared memory segments and tmpfs files. There is no cheap way to + * compute this, so just leave the field unpopulated. Linux itself only + * started setting this field in the 3.x timeframe. + */ sysinfo.sharedram = 0; - 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; swap_pager_status(&i, &j);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006150302.05F32xX6071064>