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 777fcd3cf1 "/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 <anton@ozlabs.org>
This commit is contained in:
Anton Blanchard 2020-06-26 09:06:12 +10:00 committed by Craig Small
parent 4a54ae97a0
commit 1b9ea61116

View File

@ -56,7 +56,7 @@ extern unsigned long kb_inactive;
extern unsigned long kb_mapped; extern unsigned long kb_mapped;
extern unsigned long kb_pagetables; extern unsigned long kb_pagetables;
#define BUFFSIZE (64*1024) #define BUFFSIZE (128*1024)
typedef unsigned long long jiff; 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, 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, unsigned long *__restrict pin, unsigned long *__restrict pout, unsigned long *__restrict s_in, unsigned long *__restrict sout,