lkml.org 
[lkml]   [2011]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC][PATCH 08/12] tracing/filter: Optimize short ciruit check
From
Date
On Thu, 2011-01-27 at 23:21 -0500, Steven Rostedt wrote:

> diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
> index 2677924..afe59ab 100644
> --- a/kernel/trace/trace_events_filter.c
> +++ b/kernel/trace/trace_events_filter.c
> @@ -426,9 +426,15 @@ int filter_match_preds(struct event_filter *filter, void *rec)
> pred->parent, &move);
> continue;
> case MOVE_UP_FROM_LEFT:
> - /* Check for short circuits */
> - if ((match && pred->op == OP_OR) ||
> - (!match && pred->op == OP_AND)) {
> + /*
> + * Check for short circuits.
> + *
> + * Optimization: !!match == (pred->op == OP_OR)
> + * is the same as:
> + * if ((match && pred->op == OP_OR) ||
> + * (!match && pred->op == OP_AND))
> + */
> + if (!!match == (pred->op == OP_OR))

+ {

Bah! I tested these in quilt and when I pulled them into git, I must
have accidentally deleted the '{' in the patch :-p

Thanks goodness this was only a RFC ;)

/me goes to rebase

-- Steve

> if (pred == root)
> break;
> pred = get_pred_parent(pred, preds,




\
 
 \ /
  Last update: 2011-01-28 06:39    [W:0.055 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site