From: Xunlei Pang <xpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Pratyush Anand <panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Xunlei Pang <xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 1/3] 99base: add memtrace-ko.sh to debug kernel module large memory consumption
Date: Wed, 9 Nov 2016 10:48:53 +0800 [thread overview]
Message-ID: <58228E95.5090702@redhat.com> (raw)
In-Reply-To: <beac687a-872a-6b8e-a4da-7dfa54e036c5-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On 2016/11/09 at 10:26, Pratyush Anand wrote:
>
>
> On Monday 07 November 2016 11:04 AM, Xunlei Pang wrote:
>> + # Once we get here, the task is being tracked(is loading a module).
>> + # Get the module name.
>> + module_name=${current_module[$pid]}
>> +
>> + if [[ $function = module_put* ]]; then
>
> Also need to check for refcnt=1.
> module_put can also be called by many other places.
We only care about the first one right after module_load was made, for other module_put events, will be skipped by
if ! [[ ${current_module[$pid]} ]]; then
continue
fi
because we will unset current_module[$pid](untrack the task) when parsing the first module_put() after "module_load"
where current_module[$pid](track the task loading module) is set.
>
> Moreover, do we really need to trace module_put? You have filter for module loading applications, and pids for different module load instances would be different, so even if module_put is not tracked, it should work, no?
We need to keep it, lets take an example to illustrate, "insmod mymodule" will hit "module_load" then "module_put"
(even for insert failed cases), then other possible alloc_pages events, init function of the module is called between
"module_load" and the following "module_put" trace point, we only care about alloc_pages events captured in between.
Regards,
Xunlei
>
>> + # Mark the module as loaded when the first module_put event happens after module_load.
>> + echo "${nr_alloc_pages[$module_name]} pages consumed by \"$module_name\""
>> + module_loaded[$module_name]=1
>> + # Module loading finished, so untrack the task.
>> + unset current_module[$pid]
>> + continue
>> + fi
>
> ~Pratyush
> --
> To unsubscribe from this list: send the line "unsubscribe initramfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-11-09 2:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-07 5:34 [PATCH v2 1/3] 99base: add memtrace-ko.sh to debug kernel module large memory consumption Xunlei Pang
[not found] ` <1478496876-17580-1-git-send-email-xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-07 5:34 ` [PATCH v2 2/3] 99base: apply kernel module memory debug support Xunlei Pang
[not found] ` <1478496876-17580-2-git-send-email-xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-09 8:33 ` Dave Young
[not found] ` <20161109083351.GA5663-0VdLhd/A9Pl+NNSt+8eSiB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2016-11-09 10:34 ` Xunlei Pang
[not found] ` <5822FBA1.40105-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-10 2:45 ` Dave Young
[not found] ` <20161110024505.GA3815-0VdLhd/A9Pl+NNSt+8eSiB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2016-11-10 5:56 ` Xunlei Pang
[not found] ` <58240BF6.3020207-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-10 6:25 ` Dave Young
[not found] ` <20161110062526.GA5206-0VdLhd/A9Pl+NNSt+8eSiB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2016-11-10 6:57 ` Xunlei Pang
2016-11-07 5:34 ` [PATCH v2 3/3] dracut.cmdline.7.asc: update document for rd.memdebug=4 Xunlei Pang
[not found] ` <1478496876-17580-3-git-send-email-xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-07 6:04 ` Dracut GitHub Import Bot
2016-11-09 2:26 ` [PATCH v2 1/3] 99base: add memtrace-ko.sh to debug kernel module large memory consumption Pratyush Anand
[not found] ` <beac687a-872a-6b8e-a4da-7dfa54e036c5-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-09 2:48 ` Xunlei Pang [this message]
[not found] ` <58228E95.5090702-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-09 3:06 ` Pratyush Anand
[not found] ` <c6c32731-9278-67a5-4419-201a6edf3f78-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-09 3:17 ` Xunlei Pang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=58228E95.5090702@redhat.com \
--to=xpang-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.