diff options
author | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2023-01-02 20:57:35 +0000 |
---|---|---|
committer | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2023-02-16 11:55:16 +0000 |
commit | 1b1901620028a316e55d907069b85a2f077e6db3 (patch) | |
tree | 9737b97e228e0698e41711f20c43447a4e5d1875 | |
parent | 22319e99b799b792848a0b9da2322b7bc5db8a2e (diff) |
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
(cherry picked from commit e400b695991bf3f336e9cbe39e400943d8b1d676)
-rw-r--r-- | sys/compat/linuxkpi/common/include/linux/mm.h | 8 | ||||
-rw-r--r-- | 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 43d1cb0f8aad..be3890edb5cf 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 10172d341e95..a82a8c45be01 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; } |