[Crash-utility] Re: [BUG FIXED]fix bug of CACHED in kmem -i show memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023/11/29 22:17, 薛国伦 wrote:
> Hi lianbo:
> 
> 
> I have a bug fixed need to merge to crash-utility which patch in attachment.
> 
> 
> It can obviously see that kmem -i show memory info of system.
> But CACHED have wrong output for add up size of cached memory.
> 
> The reason of this bug is:
> newest kernel version use "struct address_space *swapper_spaces[MAX_SWAPFILES]"
> instead of "struct address_space swapper_spaces[MAX_SWAPFILES]" in old kernel.
> this change bring into kernel after kernel 4.11.0

Hmm, it looks like this issue was already fixed by [1].

[1] 
https://github.com/crash-utility/crash/commit/333df037bc72aa81faf0904aaea29d43be2c724d

"nr_swapper_spaces" is not present in your kernel?

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4b3ef9daa4fc0bba742a79faecb17fdaaead083b
+struct address_space *swapper_spaces[MAX_SWAPFILES];
+static unsigned int nr_swapper_spaces[MAX_SWAPFILES];

These were introduced together..

Thanks,
Kazu

> 
> So newest version need to readmem twice, first is address of one struct address_space
> second is value of struct address_space.
> 
> This bug fix patch add twice readmem when read swapper_spaces struct, it can accurately
> read nrpage in struct address_space. And i found that definition of struct address_space swapper_spaces
> change in kernel 4.11.0, so i make kernel version compatible for this change.
> 
> fix before:
> crash> kmem -i
>                   PAGES        TOTAL      PERCENTAGE
>      TOTAL MEM  2854115      10.9 GB         ----
>           FREE   169699     662.9 MB    5% of TOTAL MEM
>           USED  2684416      10.2 GB   94% of TOTAL MEM
>         SHARED   891094       3.4 GB   31% of TOTAL MEM
>        BUFFERS      329       1.3 MB    0% of TOTAL MEM
>         CACHED  873327085626  3331478.4 GB  30598875% of TOTAL MEM
>           SLAB   230128     898.9 MB    8% of TOTAL MEM
> 
> fix after:
> crash> kmem -i
>                   PAGES        TOTAL      PERCENTAGE
>      TOTAL MEM  2854115      10.9 GB         ----
>           FREE   169699     662.9 MB    5% of TOTAL MEM
>           USED  2684416      10.2 GB   94% of TOTAL MEM
>         SHARED   891094       3.4 GB   31% of TOTAL MEM
>        BUFFERS      329       1.3 MB    0% of TOTAL MEM
>         CACHED  1729018       6.6 GB   60% of TOTAL MEM
>           SLAB   230128     898.9 MB    8% of TOTAL MEM
> 
> 
> 
> Thanks
> Best Regards
--
Crash-utility mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxxxxxx
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux