Skip to content

Commit c09d7a3

Browse files
committed
Merge branch '/tip/perf/filter' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git into perf/core
2 parents 0a10247 + 4defe68 commit c09d7a3

File tree

3 files changed

+754
-170
lines changed

3 files changed

+754
-170
lines changed

include/linux/ftrace_event.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ struct ftrace_event_call {
208208

209209
#define PERF_MAX_TRACE_SIZE 2048
210210

211-
#define MAX_FILTER_PRED 32
212211
#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */
213212

214213
extern void destroy_preds(struct ftrace_event_call *call);

kernel/trace/trace.h

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,10 @@ struct ftrace_event_field {
661661
};
662662

663663
struct event_filter {
664-
int n_preds;
665-
struct filter_pred **preds;
664+
int n_preds; /* Number assigned */
665+
int a_preds; /* allocated */
666+
struct filter_pred *preds;
667+
struct filter_pred *root;
666668
char *filter_string;
667669
};
668670

@@ -674,11 +676,23 @@ struct event_subsystem {
674676
int nr_events;
675677
};
676678

679+
#define FILTER_PRED_INVALID ((unsigned short)-1)
680+
#define FILTER_PRED_IS_RIGHT (1 << 15)
681+
#define FILTER_PRED_FOLD (1 << 15)
682+
683+
/*
684+
* The max preds is the size of unsigned short with
685+
* two flags at the MSBs. One bit is used for both the IS_RIGHT
686+
* and FOLD flags. The other is reserved.
687+
*
688+
* 2^14 preds is way more than enough.
689+
*/
690+
#define MAX_FILTER_PRED 16384
691+
677692
struct filter_pred;
678693
struct regex;
679694

680-
typedef int (*filter_pred_fn_t) (struct filter_pred *pred, void *event,
681-
int val1, int val2);
695+
typedef int (*filter_pred_fn_t) (struct filter_pred *pred, void *event);
682696

683697
typedef int (*regex_match_func)(char *str, struct regex *r, int len);
684698

@@ -700,11 +714,23 @@ struct filter_pred {
700714
filter_pred_fn_t fn;
701715
u64 val;
702716
struct regex regex;
703-
char *field_name;
717+
/*
718+
* Leaf nodes use field_name, ops is used by AND and OR
719+
* nodes. The field_name is always freed when freeing a pred.
720+
* We can overload field_name for ops and have it freed
721+
* as well.
722+
*/
723+
union {
724+
char *field_name;
725+
unsigned short *ops;
726+
};
704727
int offset;
705728
int not;
706729
int op;
707-
int pop_n;
730+
unsigned short index;
731+
unsigned short parent;
732+
unsigned short left;
733+
unsigned short right;
708734
};
709735

710736
extern struct list_head ftrace_common_fields;

0 commit comments

Comments
 (0)