On 2023/02/15 15:35, lijiang wrote:>>> Hi, Kazu
>> Thank you for the comment.
>>
>> On Wed, Feb 15, 2023 at 1:38 PM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab(a)nec.com
<mailto:k-hagio-ab@nec.com>> wrote:
>>
>> On 2023/02/14 23:37, Lianbo Jiang wrote:
>> > The "kmem -i" option may output the bogus statistics of
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 gets a big integer.
>> >
>> > 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
>> > ^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^
>>
>> I think that this is not very bad output :) because we can notice
>> the negative value. Maybe it's due to future kernel changes.
>>
>>
>> It's true. But it is also easy to mislead users, because it is not clear
whether the crash tool
>> gave a wrong result.
>>
>> Actually this issue was observed on the kernel 3.10.
>>
>> So if you set it to zero, what about emitting an info message?
>>
>>
>> It should be good to have an info message.
>>
>> + if (page_cache_size < 0) {
>> + error(INFO, "page_cache_size went negative (%ld),
setting to 0\n",
>> + page_cache_size);
>> + page_cache_size = 0;
>> + }
>>
>>
>> Looks good.
ok thanks for checking, applied.
https://github.com/crash-utility/crash/commit/277da34dd5da8c1280d0d0fd7ce...
Thanks,
Kazu