[Crash-utility] Re: [External Mail]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 12/1/23 16:30, 薛国伦 wrote:

Hi kazu:


I found that vmlinux of GKI kernel-6.1 which is newest version in links below, it can make sure that nr_swapper_spaces not found.


https://ci.android.com/builds/submitted/11087000/kernel_aarch64/latest?hl=zh-cn <https://ci.android.com/builds/submitted/11087000/kernel_aarch64/latest?hl=zh-cn>


Download vmlinux in links and run: readelf -a vmlinux | grep nr_swapper_spaces


It's weird, I downloaded the vmlinux from the above link, got the nr_swapper_spaces:

$ md5sum vmlinux
7d47aa96b3812e6ca607de7e297307a1  vmlinux


$ strings vmlinux |grep nr_swapper_spaces
nr_swapper_spaces
nr_swapper_spaces
nr_swapper_spaces


$ readelf -a vmlinux |grep nr_swapper_spaces
 17111: c000000001856810   108 OBJECT  LOCAL  DEFAULT   47 nr_swapper_spaces


Has the vmlinux been updated again?


Thanks

Lianbo


can not find this symbol.


Thanks!
Best Regards
------------------------------------------------------------------------
*From:* 薛国伦
*Sent:* Friday, December 1, 2023 4:07:08 PM
*To:* HAGIO KAZUHITO(萩尾 一仁); devel@xxxxxxxxxxxxxxxxxxxxxxxxxxx
*Cc:* Lianbo Jiang
*Subject:* Re: [External Mail]Re: [BUG FIXED]fix bug of CACHED in kmem -i show memory

Hi kazu:


1. I know that kernel have nr_swapper_spaces since kernel 4.11 which brought into kernel with struct address_space *swapper_spaces[]

my team think GKI vmlinux did not have nr_swapper_spaces this symbol, may due to compile rule changed in AOSP code.

we will try to find the root cause of vmlinux without symbol name nr_swappera_space.


     >> RELEASE: 6.1.25-android14-11-maybe-dirty-qki-consolidate
     >> crash> nr_swapper_spaces
     >> crash: command not found: nr_swapper_spaces

2. I printf log of crash when execute kmem -i, it run into branch of "symbol_exists("swapper_spaces")", also can not find nr_swapper_spaces


if (symbol_exists("nr_swapper_spaces") {

    ......

} else if (symbol_exists("swapper_spaces") {

    ......

} else if (symbol_exists("swapper_space") {

    ......

}


3. using my patch, it can fix output log of kmem -i which CACHED show not right.


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


I think crash tools without my patch, maybe miss some situation like this which symbol miss in kenrel vmlinux. I think that using both branch of symbol_exist("nr_swapper_spaces") and symbol_exists("swapper_spaces") means to double check
the situation of all kinds of kernel and vmlinux.
It seen that bring my patch can deal with more unusual situation and make crash tool more compatible.


Thanks!
Best Regards

------------------------------------------------------------------------
*From:* HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab@xxxxxxx>
*Sent:* Friday, December 1, 2023 3:08:03 PM
*To:* 薛国伦; devel@xxxxxxxxxxxxxxxxxxxxxxxxxxx
*Cc:* Lianbo Jiang
*Subject:* Re: [External Mail]Re: [BUG FIXED]fix bug of CACHED in kmem -i show memory [外部邮件] 此邮件来源于小米公司外部,请谨慎处理。若对邮件安全性存疑,请将邮件转发给misec@xxxxxxxxxx进行反馈

On 2023/11/30 22:05, 薛国伦 wrote:
> Hi kazu:
>
>
> 1. I found that vmlinux of kernel-6.1 did not have symbol nr_swapper_spaces but only have swapper_spaces
>
> Also check in GKI vmlinux, can not find nr_swapper_spaces

Hmm, upstream kernel 6.1 has it.

$ git show v6.1:mm/swap_state.c

struct address_space *swapper_spaces[MAX_SWAPFILES] __read_mostly;
static unsigned int nr_swapper_spaces[MAX_SWAPFILES] __read_mostly;

>
> It may have some problem in symbol of nr_swapper_spaces
>
>
> 2. I think that crash tools will check nr_swapper_spaces first and then check *swapper_spaces, swaper_space[] last.
>
> so first check nr_swapper_spaces not found, crash tool can use *swapper_spaces to enhance compatibility.
>
> The patch i send can resolve this situation which nr_swapper_spaces symbols can not found.

But I cannot determine whether your patch is correct and should be
applied, without kernel patches or the cause of no nr_swapper_spaces.
Could you please find the information (e.g. links) of the related kernel
patches?

Thanks,
Kazu
#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! 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!******/#
--
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