git: e400b695991b - main - linuxkpi: Add `freeram` and `freehigh` to `struct sysinfo`
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 30 Jan 2023 22:17:35 UTC
The branch main has been updated by dumbbell (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e400b695991bf3f336e9cbe39e400943d8b1d676 commit e400b695991bf3f336e9cbe39e400943d8b1d676 Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> AuthorDate: 2023-01-02 20:57:35 +0000 Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> CommitDate: 2023-01-30 22:08:32 +0000 linuxkpi: Add `freeram` and `freehigh` to `struct sysinfo` The struct layout is modified with this commit because new fields are added in the middle, keeping original Linux order. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D37932 --- sys/compat/linuxkpi/common/include/linux/mm.h | 8 +++++--- sys/compat/linuxkpi/common/src/linux_page.c | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h index 542d0c874b43..c6861cc2acbf 100644 --- a/sys/compat/linuxkpi/common/include/linux/mm.h +++ b/sys/compat/linuxkpi/common/include/linux/mm.h @@ -144,9 +144,11 @@ struct vm_operations_struct { }; struct sysinfo { - uint64_t totalram; - uint64_t totalhigh; - uint32_t mem_unit; + uint64_t totalram; /* Total usable main memory size */ + uint64_t freeram; /* Available memory size */ + uint64_t totalhigh; /* Total high memory size */ + uint64_t freehigh; /* Available high memory size */ + uint32_t mem_unit; /* Memory unit size in bytes */ }; /* diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index 9b3dac96081f..6fcf9373a2f5 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -79,7 +79,9 @@ void si_meminfo(struct sysinfo *si) { si->totalram = physmem; + si->freeram = vm_free_count(); si->totalhigh = 0; + si->freehigh = 0; si->mem_unit = PAGE_SIZE; }