linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: xinhui <xinhui.pan@linux.vnet.ibm.com>
To: Byungchul Park <byungchul.park@lge.com>,
	peterz@infradead.org, mingo@kernel.org
Cc: linux-kernel@vger.kernel.org, npiggin@suse.de, walken@google.com,
	ak@suse.de
Subject: Re: [RFC 12/12] x86/dumpstack: Optimize save_stack_trace
Date: Thu, 30 Jun 2016 18:38:47 +0800	[thread overview]
Message-ID: <5774F6B7.5050200@linux.vnet.ibm.com> (raw)
In-Reply-To: <20160629124343.GQ2279@X58A-UD3R>



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 = {
>>>>
>

  reply	other threads:[~2016-06-30 10:39 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20  4:55 [RFC 00/12] lockdep: Implement crossrelease feature Byungchul Park
2016-06-20  4:55 ` [RFC 01/12] lockdep: Refactor lookup_chain_cache() Byungchul Park
2016-06-20  4:55 ` [RFC 02/12] lockdep: Add a function building a chain between two hlocks Byungchul Park
2016-06-20  4:55 ` [RFC 03/12] lockdep: Make check_prev_add can use a stack_trace of other context Byungchul Park
2016-06-20  4:55 ` [RFC 04/12] lockdep: Make save_trace can copy from other stack_trace Byungchul Park
2016-06-20  4:55 ` [RFC 05/12] lockdep: Implement crossrelease feature Byungchul Park
2016-06-30 13:03   ` Peter Zijlstra
2016-06-30 23:28     ` Byungchul Park
2016-06-20  4:55 ` [RFC 06/12] lockdep: Apply crossrelease to completion Byungchul Park
2016-06-20  4:55 ` [RFC 07/12] pagemap.h: Remove trailing white space Byungchul Park
2016-06-20  4:55 ` [RFC 08/12] lockdep: Apply crossrelease to PG_locked lock Byungchul Park
2016-06-30 13:04   ` Peter Zijlstra
2016-06-30 23:21     ` Byungchul Park
2016-07-01  8:10       ` Peter Zijlstra
2016-07-01 11:18       ` Kirill A. Shutemov
2016-07-04  4:30         ` Byungchul Park
2016-06-20  4:55 ` [RFC 09/12] cifs/file.c: Remove trailing white space Byungchul Park
2016-06-20  4:55 ` [RFC 10/12] mm/swap_state.c: " Byungchul Park
2016-06-20  4:55 ` [RFC 11/12] lockdep: Call lock_acquire(release) when accessing PG_locked manually Byungchul Park
2016-06-20  4:55 ` [RFC 12/12] x86/dumpstack: Optimize save_stack_trace Byungchul Park
2016-06-20  7:29   ` xinhui
2016-06-20  7:50     ` byungchul.park
2016-06-29 12:43       ` Byungchul Park
2016-06-30 10:38         ` xinhui [this message]
2016-06-30 23:06           ` Byungchul Park
2016-06-23 23:37 ` [RFC 00/12] lockdep: Implement crossrelease feature Byungchul Park
2016-06-24  7:08   ` Peter Zijlstra
2016-06-24 11:13     ` Byungchul Park
2016-06-24 11:26   ` Nikolay Borisov
2016-06-27  1:34     ` Byungchul Park
2016-07-01  4:15 ` [PATCH] lockdep: Add a document describing " Byungchul Park
2016-07-01 10:45   ` Peter Zijlstra
2016-07-04  6:42     ` Byungchul Park
2016-07-06  0:49       ` Boqun Feng
2016-07-06  2:17         ` Byungchul Park
2016-07-06  5:33           ` Byungchul Park
2016-07-06  7:56             ` Peter Zijlstra
2016-07-06  8:12               ` Byungchul Park

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=5774F6B7.5050200@linux.vnet.ibm.com \
    --to=xinhui.pan@linux.vnet.ibm.com \
    --cc=ak@suse.de \
    --cc=byungchul.park@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=npiggin@suse.de \
    --cc=peterz@infradead.org \
    --cc=walken@google.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).