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

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
#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#