linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Janani Ravichandran <janani.rvchndrn@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	riel@surriel.com, akpm@linux-foundation.org, hannes@compxchg.org,
	vdavydov@virtuozzo.com, mhocko@suse.com, vbabka@suse.cz,
	mgorman@techsingularity.net, kirill.shutemov@linux.intel.com,
	bywxiaobai@163.com
Subject: Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath
Date: Thu, 4 Aug 2016 11:19:46 -0400	[thread overview]
Message-ID: <20160804111946.6cbbd30b@gandalf.local.home> (raw)
In-Reply-To: <0AF03F78-AA34-4531-899A-EA1076B6B3A1@gmail.com>

On Fri, 29 Jul 2016 01:41:20 +0530
Janani Ravichandran <janani.rvchndrn@gmail.com> wrote:

Sorry for the late reply, I've been swamped with other things since
coming back from my vacation.

> I looked at function graph trace, as you’d suggested. I saw that I could set a threshold 
> there using tracing_thresh. But the problem was that slowpath trace information was printed
> for all the cases (even when __alloc_pages_nodemask latencies were below the threshold).
> Is there a way to print tracepoint information only when __alloc_pages_nodemask
> exceeds the threshold?

One thing you could do is to create your own module and hook into the
function graph tracer yourself!

It would require a patch to export two functions in
kernel/trace/ftrace.c:

 register_ftrace_graph()
 unregister_ftrace_graph()

Note, currently only one user of these functions is allowed at a time.
If function_graph tracing is already enabled, the register function
will return -EBUSY.

You pass in a "retfunc" and a "entryfunc" (I never understood why they
were backwards), and these are the functions that are called when a
function returns and when a function is entered respectively.

The retfunc looks like this:

static void my_retfunc(struct ftrace_graph_ret *trace)
{
	[...]
}

static int my_entryfunc(struct ftrace_graph_ent *trace)
{
	[...]
}


The ftrace_graph_ret structure looks like this:

struct ftrace_graph_ret {
	unsigned long func;
	unsigned long overrun;
	unsigned long calltime;
	unsigned long rettime;
	int depth;
};

Where func is actually the instruction pointer of the function that is
being traced.

You can ignore "overrun".

calltime is the trace_clock_local() (sched_clock() like timestamp) of
when the function was entered.

rettime is the trace_clock_local() timestamp of when the function
returns.

 rettime - calltime is the time difference of the entire function.

And that's the time you want to look at.

depth is how deep into the call chain the current function is. There's
a limit (50 I think), of how deep it will record, and anything deeper
will go into that "overrun" field I told you to ignore.


Hmm, looking at the code, it appears setting tracing_thresh should
work. Could you show me exactly what you did?

Either way, adding your own function graph hook may be a good exercise
in seeing how all this works.

-- Steve

  reply	other threads:[~2016-08-04 15:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 14:43 [PATCH 0/2] New tracepoints for slowpath and memory compaction Janani Ravichandran
2016-07-27 14:47 ` [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Janani Ravichandran
2016-07-27 15:23   ` Steven Rostedt
2016-07-27 17:20     ` Dave Hansen
2016-07-27 17:30       ` Steven Rostedt
2016-07-28 20:11     ` Janani Ravichandran
2016-08-04 15:19       ` Steven Rostedt [this message]
2016-08-05 16:03         ` Janani Ravichandran
2016-08-05 16:30           ` Steven Rostedt
2016-08-07 10:36             ` Janani Ravichandran
2016-07-27 16:33   ` Michal Hocko
2016-07-27 18:16     ` Rik van Riel
2016-07-27 18:28       ` Steven Rostedt
2016-07-27 18:44       ` Michal Hocko
2016-07-27 18:57         ` Rik van Riel
2016-07-27 14:51 ` [PATCH 2/2] mm: compaction.c: Add/Modify direct compaction tracepoints Janani Ravichandran
2016-07-27 15:24   ` Steven Rostedt
2016-08-01 13:25   ` Vlastimil Babka
2016-08-07 12:32     ` Janani Ravichandran

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=20160804111946.6cbbd30b@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=bywxiaobai@163.com \
    --cc=hannes@compxchg.org \
    --cc=janani.rvchndrn@gmail.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=riel@surriel.com \
    --cc=vbabka@suse.cz \
    --cc=vdavydov@virtuozzo.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).