>>> (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.
hmm, this sounds strange. My ack is for Johan's patch (attached), which
does not have kernel version check, is this ok? sorry for confusing.
Johan, your patch does not have your Signed-off-by tag, could I have it?
Sure, attaching it with Signed-off-by tag.
Thanks for looking into it.
Johan