From 1b9ea61116a625456a89dd7d26b3e4c3d390a599 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Fri, 26 Jun 2020 09:06:12 +1000 Subject: [PATCH] Increase BUFFSIZE to handle very large /proc/stat files We read /proc/stat using a statically sized buffer. This was increased to 64kB in 2005 via commit 777fcd3cf15d "/proc/stat for 1024 CPUs". Unfortunately in 2020, 1024 CPUs is not enough for anyone. I have a large machine where /proc/stat is 74kB, and vmstat gives incorrect output. Double the buffer to 128kB in the confidence that 2048 CPUs is actually enough for anyone. Signed-off-by: Anton Blanchard --- proc/sysinfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proc/sysinfo.h b/proc/sysinfo.h index 0a2c888d..73e84bc9 100644 --- a/proc/sysinfo.h +++ b/proc/sysinfo.h @@ -56,7 +56,7 @@ extern unsigned long kb_inactive; extern unsigned long kb_mapped; extern unsigned long kb_pagetables; -#define BUFFSIZE (64*1024) +#define BUFFSIZE (128*1024) typedef unsigned long long jiff; extern void getstat(jiff *__restrict cuse, jiff *__restrict cice, jiff *__restrict csys, jiff *__restrict cide, jiff *__restrict ciow, jiff *__restrict cxxx, jiff *__restrict cyyy, jiff *__restrict czzz, unsigned long *__restrict pin, unsigned long *__restrict pout, unsigned long *__restrict s_in, unsigned long *__restrict sout,