On 2016/11/02 at 13:41, Dave Young wrote:
On 11/02/16 at 01:18pm, Xunlei Pang wrote:
> On 2016/11/02 at 13:07, 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
> Hi Dave,
>
> This is on purpose by always returning 0(true), you can run it like this:
>
> . dracut-memdebug-ko.sh
To drop the "return" it is better to add some functions, and then in
this scripts call the functions, then no need return and exit any more.
Yes, will update this way when making dracut patch.
Regards,
Xunlei
>
> Strictly this script should be run under dracut environment, it includes something
like "warn" which is implemented by dracut.
> But normally it still works.
>
> Regards,
> Xunlei