Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1433713 > unrolled thread

Re: [RFC 12/12] x86/dumpstack: Optimize save_stack_trace

Started byByungchul Park <byungchul.park@lge.com>
First post2016-06-29 14:50 +0200
Last post2016-07-01 01:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC 12/12] x86/dumpstack: Optimize save_stack_trace Byungchul Park <byungchul.park@lge.com> - 2016-06-29 14:50 +0200
    Re: [RFC 12/12] x86/dumpstack: Optimize save_stack_trace xinhui <xinhui.pan@linux.vnet.ibm.com> - 2016-06-30 12:40 +0200
      Re: [RFC 12/12] x86/dumpstack: Optimize save_stack_trace Byungchul Park <byungchul.park@lge.com> - 2016-07-01 01:10 +0200

#1433713 — Re: [RFC 12/12] x86/dumpstack: Optimize save_stack_trace

FromByungchul Park <byungchul.park@lge.com>
Date2016-06-29 14:50 +0200
SubjectRe: [RFC 12/12] x86/dumpstack: Optimize save_stack_trace
Message-ID<rPn6h-4ei-13@gated-at.bofh.it>
On Mon, Jun 20, 2016 at 04:50:37PM +0900, byungchul.park wrote:
> > -----Original Message-----
> > From: xinhui [mailto:xinhui.pan@linux.vnet.ibm.com]
> > Sent: Monday, June 20, 2016 4:29 PM
> > To: Byungchul Park; peterz@infradead.org; mingo@kernel.org
> > Cc: linux-kernel@vger.kernel.org; npiggin@suse.de; walken@google.com;
> > ak@suse.de; tglx@inhelltoy.tec.linutronix.de
> > Subject: Re: [RFC 12/12] x86/dumpstack: Optimize save_stack_trace
> > 
> > 
> > On 2016年06月20日 12:55, Byungchul Park wrote:
> > > Currently, x86 implementation of save_stack_trace() is walking all stack
> > > region word by word regardless of what the trace->max_entries is.
> > > However, it's unnecessary to walk after already fulfilling caller's
> > > requirement, say, if trace->nr_entries >= trace->max_entries is true.
> > >
> > > For example, CONFIG_LOCKDEP_CROSSRELEASE implementation calls
> > > save_stack_trace() with max_entries = 5 frequently. I measured its
> > > overhead and printed its difference of sched_clock() with my QEMU x86
> > > machine.
> > >
> > > The latency was improved over 70% when trace->max_entries = 5.
> > >
> > [snip]
> > 
> > > +static int save_stack_end(void *data)
> > > +{
> > > +	struct stack_trace *trace = data;
> > > +	return trace->nr_entries >= trace->max_entries;
> > > +}
> > > +
> > >   static const struct stacktrace_ops save_stack_ops = {
> > >   	.stack		= save_stack_stack,
> > >   	.address	= save_stack_address,
> > then why not check the return value of ->address(), -1 indicate there is
> > no room to store any pointer.
> 
> Hello,
> 
> Indeed. It also looks good to me even though it has to propagate the condition
> between callback functions. I will modify it if it's better.

Do you also think it would be better to make it propagate the result of
->address() rather than add a new callback, say, end_walk?

> 
> Thank you.
> Byungchul
> 
> > 
> > >   	.walk_stack	= print_context_stack,
> > > +	.end_walk	= save_stack_end,
> > >   };
> > >
> > >   static const struct stacktrace_ops save_stack_ops_nosched = {
> > >

[toc] | [next] | [standalone]


#1434436

Fromxinhui <xinhui.pan@linux.vnet.ibm.com>
Date2016-06-30 12:40 +0200
Message-ID<rPHy1-8rT-1@gated-at.bofh.it>
In reply to#1433713

On 2016年06月29日 20:43, Byungchul Park wrote:
> On Mon, Jun 20, 2016 at 04:50:37PM +0900, byungchul.park wrote:
>>> -----Original Message-----
>>> From: xinhui [mailto:xinhui.pan@linux.vnet.ibm.com]
>>> Sent: Monday, June 20, 2016 4:29 PM
>>> To: Byungchul Park; peterz@infradead.org; mingo@kernel.org
>>> Cc: linux-kernel@vger.kernel.org; npiggin@suse.de; walken@google.com;
>>> ak@suse.de; tglx@inhelltoy.tec.linutronix.de
>>> Subject: Re: [RFC 12/12] x86/dumpstack: Optimize save_stack_trace
>>>
>>>
>>> On 2016年06月20日 12:55, Byungchul Park wrote:
>>>> Currently, x86 implementation of save_stack_trace() is walking all stack
>>>> region word by word regardless of what the trace->max_entries is.
>>>> However, it's unnecessary to walk after already fulfilling caller's
>>>> requirement, say, if trace->nr_entries >= trace->max_entries is true.
>>>>
>>>> For example, CONFIG_LOCKDEP_CROSSRELEASE implementation calls
>>>> save_stack_trace() with max_entries = 5 frequently. I measured its
>>>> overhead and printed its difference of sched_clock() with my QEMU x86
>>>> machine.
>>>>
>>>> The latency was improved over 70% when trace->max_entries = 5.
>>>>
>>> [snip]
>>>
>>>> +static int save_stack_end(void *data)
>>>> +{
>>>> +	struct stack_trace *trace = data;
>>>> +	return trace->nr_entries >= trace->max_entries;
>>>> +}
>>>> +
>>>>    static const struct stacktrace_ops save_stack_ops = {
>>>>    	.stack		= save_stack_stack,
>>>>    	.address	= save_stack_address,
>>> then why not check the return value of ->address(), -1 indicate there is
>>> no room to store any pointer.
>>
>> Hello,
>>
>> Indeed. It also looks good to me even though it has to propagate the condition
>> between callback functions. I will modify it if it's better.
>
> Do you also think it would be better to make it propagate the result of
> ->address() rather than add a new callback, say, end_walk?
>
It's up to you. In my opinion, end_walk is better for reading.
  
>>
>> Thank you.
>> Byungchul
>>
>>>
>>>>    	.walk_stack	= print_context_stack,
>>>> +	.end_walk	= save_stack_end,
>>>>    };
>>>>
>>>>    static const struct stacktrace_ops save_stack_ops_nosched = {
>>>>
>

[toc] | [prev] | [next] | [standalone]


#1434898

FromByungchul Park <byungchul.park@lge.com>
Date2016-07-01 01:10 +0200
Message-ID<rPTfP-7eS-1@gated-at.bofh.it>
In reply to#1434436
On Thu, Jun 30, 2016 at 06:38:47PM +0800, xinhui wrote:
> >>>>+static int save_stack_end(void *data)
> >>>>+{
> >>>>+	struct stack_trace *trace = data;
> >>>>+	return trace->nr_entries >= trace->max_entries;
> >>>>+}
> >>>>+
> >>>>   static const struct stacktrace_ops save_stack_ops = {
> >>>>   	.stack		= save_stack_stack,
> >>>>   	.address	= save_stack_address,
> >>>then why not check the return value of ->address(), -1 indicate there is
> >>>no room to store any pointer.
> >>
> >>Hello,
> >>
> >>Indeed. It also looks good to me even though it has to propagate the condition
> >>between callback functions. I will modify it if it's better.
> >
> >Do you also think it would be better to make it propagate the result of
> >->address() rather than add a new callback, say, end_walk?
> >
> It's up to you. In my opinion, end_walk is better for reading.

I also prefer the way this patch works.

> >>
> >>Thank you.
> >>Byungchul
> >>
> >>>
> >>>>   	.walk_stack	= print_context_stack,
> >>>>+	.end_walk	= save_stack_end,
> >>>>   };
> >>>>
> >>>>   static const struct stacktrace_ops save_stack_ops_nosched = {
> >>>>
> >

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web