]> git.sesse.net Git - bcachefs-tools-debian/commit
bcachefs-tools: Use sysinfo(2) directly to implement si_meminfo()
authorChris Webb <chris@arachsys.com>
Sat, 9 Dec 2023 12:49:12 +0000 (12:49 +0000)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 10 Dec 2023 04:26:29 +0000 (23:26 -0500)
commitddc71615311b9f134f6e1c3caaf6ff7bf1bddaeb
tree9aa3a60c96aead6ba61591f55c97db3458f0f656
parent2d5118e01fddf09a9f9b9713d857b70515cc9b4b
bcachefs-tools: Use sysinfo(2) directly to implement si_meminfo()

Use a single sysinfo(2) call to fill out struct sysinfo instead of
multiple libc sysconf(3) requests, which will only make sysinfo(2) calls
internally anyway. This also enables us to access other struct sysinfo
fields, not just the three filled-out previously.

As we provide our own definition of struct sysinfo in include/linux/mm.h
to match the kernel, which is not guaranteed to align with the definition
libc provides in <sys/sysinfo.h>, use syscall(SYS_sysinfo, ...) directly
instead of the libc wrapper.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
include/linux/mm.h
linux/shrinker.c