On 12/7/23 12:12, HAGIO KAZUHITO(萩尾 一仁) wrote:
On 2023/12/07 10:07, Lianbo Jiang wrote:
> On 12/6/23 11:45, 薛国伦 wrote:
>
>> Hi Lianbo:
>>
>>
>> the vmlinux i download from links:
>>
https://ci.android.com/builds/submitted/11087000/kernel_aarch64/latest?hl...
<
https://ci.android.com/builds/submitted/11087000/kernel_aarch64/latest?hl...
>>
>>
>> md5sum ~/Downloads/vmlinux
>>
>> 5927b52ad342e6e34136b04b9d16ab46 vmlinux
>>
> It's true, it looks like the variable nr_swapper_spaces is optimized away.
>
>
> (gdb) p linux_banner
> $3 = "Linux version 6.1.43-android14-11-gebd072ea164a-ab11087000
> (build-user@build-host) (Android (10087095, +pgo, +bolt, +lto, -mlgo,
> based on r487747c) clang version 17.0.2 (
https://android.googlesource.c"...
>
>
> (gdb) p nr_swapper_spaces
> $4 = <optimized out>
Thank you folks, for the various information.
Apparently the data of nr_swapper_spaces exists in the kernel, but its
symbol does not exist. I think this means that we cannot calculate the
number of pages from swapper_spaces[] with such a debuginfo, because we
cannot get the array size of a swapper_spaces entry.
That's correct, Kazu.
So I'd like to go with Johan's patch.
cc -c -g -DX86_64 -DLZO -DSNAPPY -DGDB_10_2 memory.c -Wall -O2
-Wstrict-prototypes -Wmissing-prototypes -fstack-protector
-Wformat-security
memory.c: In function dump_kmeminfo:
memory.c:8612:50: warning: pointer targets in passing argument 2 of
dump_vm_stat differ in signedness [-Wpointer-sign]
8612 | if (dump_vm_stat("NR_SWAPCACHE",
&swapper_space_nrpages, 0)) {
|
^~~~~~~~~~~~~~~~~~~~~~
| |
| ulong * {aka
long unsigned int *}
memory.c:298:33: note: expected long int * but argument is of type ulong
* {aka long unsigned int *}
298 | static int dump_vm_stat(char *, long *, ulong);
| ^~~~~~
So with the following,
- ulong swapper_space_nrpages;
+ long swapper_space_nrpages;
Looks good. Maybe the patch log also needs to be improved a little bit.
Although the checking of kernel version looks not very good, seems no
better way.
For the patch: Ack
Lianbo
Acked-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
Thanks,
Kazu