On 11/02/16 at 01:24pm, Xunlei Pang wrote:
On 2016/11/02 at 13:13, Dave Young wrote:
> On 11/02/16 at 01:07pm, Dave Young wrote:
>> On 10/31/16 at 03:15pm, Xunlei Pang wrote:
>>> Add dracut-memdebug-ko.sh, install it to the dracut kdump module.
>>>
>>> The principle is to use kernel trace to track buddy page allocation
>>> events during kernel module loading(module_init), thus we can analyze
>>> all the trace data and get the total memory consumption. as for large
>>> slab allocation, it will fall into buddy, thus tracing
"mm_page_alloc"
>>> only should be enough for the purpose.
>>>
>>> One major flaw of this method is that it consumes a lot of memory, users
>>> should increase the crash kernel memory reservation or trace buffer size
>>> (via "trace_buf_size=nn[KMG]") as needed.
>>>
>>> Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
>>> ---
>>> dracut-memdebug-ko.sh | 117
++++++++++++++++++++++++++++++++++++++++++++++++++
>> Have not dig the details, just run the script I got:
>> ./dracut-memdebug-ko.sh: line 117: return: can only `return' from a
>> function or sourced script
> replace all return with exit works for me.
>
> Cool, it can be used as a standalone script without dracut dependent. Is
> it possible to extend it and create a standalone package?
It actually contains three stages: 1) prepare and setup trace; 2) collect enough trace
data; 3) parse the trace data.
It relys on dracut to determine the proper stages, or at least some manual setup.
I used it manually:
./dracut-memdebug-ko.sh
modprobe somemodule
./dracut-memdebug-ko.sh 1
So seems if is still useful, but it is just an random thought, there
might be other page alloc during the module loading, I'm not sure if we
can distingush them.
>
> Regards,
> Xunlei
>
> >> Thanks
> >> Dave
>