Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jun 2020 23:52:50 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r362037 - head/sys/compat/linux
Message-ID:  <202006102352.05ANqoYs073418@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Jun 10 23:52:50 2020
New Revision: 362037
URL: https://svnweb.freebsd.org/changeset/base/362037

Log:
  Fix a couple of nits in Linux sysinfo(2) emulation.
  
  - Use the same definition of free memory as Linux.
  - Rename the totalbig and freebig fields to match the corresponding
    names on Linux.
  
  Discussed with:	alc
  MFC after:	1 week

Modified:
  head/sys/compat/linux/linux_misc.c

Modified: head/sys/compat/linux/linux_misc.c
==============================================================================
--- head/sys/compat/linux/linux_misc.c	Wed Jun 10 23:52:39 2020	(r362036)
+++ head/sys/compat/linux/linux_misc.c	Wed Jun 10 23:52:50 2020	(r362037)
@@ -132,8 +132,8 @@ struct l_sysinfo {
 	l_ulong		freeswap;	/* swap space still available */
 	l_ushort	procs;		/* Number of current processes */
 	l_ushort	pads;
-	l_ulong		totalbig;
-	l_ulong		freebig;
+	l_ulong		totalhigh;
+	l_ulong		freehigh;
 	l_uint		mem_unit;
 	char		_f[20-2*sizeof(l_long)-sizeof(l_int)];	/* padding */
 };
@@ -165,7 +165,7 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_
 		    LINUX_SYSINFO_LOADS_SCALE / averunnable.fscale;
 
 	sysinfo.totalram = physmem * PAGE_SIZE;
-	sysinfo.freeram = sysinfo.totalram - vm_wire_count() * PAGE_SIZE;
+	sysinfo.freeram = (u_long)vm_free_count() * PAGE_SIZE;
 
 	/*
 	 * sharedram counts pages allocated to named, swap-backed objects such
@@ -182,9 +182,13 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_
 
 	sysinfo.procs = nprocs;
 
-	/* The following are only present in newer Linux kernels. */
-	sysinfo.totalbig = 0;
-	sysinfo.freebig = 0;
+	/*
+	 * Platforms supported by the emulation layer do not have a notion of
+	 * high memory.
+	 */
+	sysinfo.totalhigh = 0;
+	sysinfo.freehigh = 0;
+
 	sysinfo.mem_unit = 1;
 
 	return (copyout(&sysinfo, args->info, sizeof(sysinfo)));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006102352.05ANqoYs073418>