Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for "kmem -i" option to not print invalid values for CACHED
The "kmem -i" option may output a bogus statistics for CACHED, which might be observed when some extreme situations occur in kernel, such as OOM, disk IO errors, etc. The following result of calculation may be a negative value, refer to the dump_kmeminfo(): page_cache_size = nr_file_pages - swapper_space_nrpages - buffer_pages; As a result, the negative value will be converted to unsigned long integer, eventually it overflows and is printed as big integers. crash> kmem -i PAGES TOTAL PERCENTAGE TOTAL MEM 255314511 973.9 GB ---- FREE 533574 2 GB 0% of TOTAL MEM USED 254780937 971.9 GB 99% of TOTAL MEM SHARED 1713 6.7 MB 0% of TOTAL MEM BUFFERS 374 1.5 MB 0% of TOTAL MEM CACHED -114 70368744177664 GB 72251060080% of TOTAL MEM ^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ... Let's normalize it to zero with an info message to fix such cornor cases. Reported-by: Buland Kumar Singh <bsingh@redhat.com> Signed-off-by: Lianbo Jiang <lijiang@redhat.com> Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
- Loading branch information