Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1343310
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH net-next 1/3] perf: generalize perf_callchain |
| Date | 2016-02-25 17:50 +0100 |
| Message-ID | <r67h0-6Ay-11@gated-at.bofh.it> (permalink) |
| References | <r3nV0-87u-5@gated-at.bofh.it> <r3nV0-87u-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Feb 17, 2016 at 07:58:57PM -0800, Alexei Starovoitov wrote:
> +static inline int perf_callchain_store(struct perf_callchain_entry *entry, u64 ip)
> {
> + if (entry->nr < PERF_MAX_STACK_DEPTH) {
> entry->ip[entry->nr++] = ip;
> + return 0;
> + } else {
> + return -1; /* no more room, stop walking the stack */
> + }
> }
Why 0 and -1 ?
What's wrong with something like:
static inline bool perf_callchain_store(struct perf_callchain_entry *entry, u64 ip)
{
if (entry->nr < PERF_MAX_STACK_DEPTH) {
entry->ip[entry->nr++] = ip;
return true;
}
return false;
}
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH net-next 1/3] perf: generalize perf_callchain Peter Zijlstra <peterz@infradead.org> - 2016-02-25 17:50 +0100 Re: [PATCH net-next 1/3] perf: generalize perf_callchain Alexei Starovoitov <ast@fb.com> - 2016-02-25 18:30 +0100
csiph-web