tracing: Rewrite filter logic to be simpler and faster

Al Viro reviewed the filter logic of ftrace trace events and found it to be
very troubling. It creates a binary tree based on the logic operators and
walks it during tracing. He sent myself and Tom Zanussi a long explanation
(and formal proof) of how to do the string parsing better and end up with a
program array that can be simply iterated to come up with the correct
results.

I took his ideas and his pseudo code and rewrote the filter logic based on
them. In doing so, I was able to remove a lot of code, and have a much more
condensed filter logic in the process. I wrote a very long comment
describing the methadology that Al proposed in my own words. For more info
on how this works, read the comment above predicate_parse().

Suggested-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
Steven Rostedt (VMware) 2018-03-09 13:19:28 -05:00
Родитель 478325f188
Коммит 80765597bc
2 изменённых файлов: 1005 добавлений и 1223 удалений

Просмотреть файл

@ -1216,11 +1216,10 @@ struct ftrace_event_field {
int is_signed;
};
struct prog_entry;
struct event_filter {
int n_preds; /* Number assigned */
int a_preds; /* allocated */
struct filter_pred __rcu *preds;
struct filter_pred __rcu *root;
struct prog_entry __rcu *prog;
char *filter_string;
};
@ -1415,10 +1414,6 @@ struct filter_pred {
int offset;
int not;
int op;
unsigned short index;
unsigned short parent;
unsigned short left;
unsigned short right;
};
static inline bool is_string_field(struct ftrace_event_field *field)

Разница между файлами не показана из-за своего большого размера Загрузить разницу