perf tools: Import rb_erase_init from block/ in the kernel sources
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: 9402e23f90c5a672db7170e4c0f1fc80ca8c009a Gitweb: http://git.kernel.org/tip/9402e23f90c5a672db7170e4c0f1fc80ca8c009a Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Mon, 25 May 2015 11:49:11 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 27 May 2015 12:21:44 -0300
perf tools: Import rb_erase_init from block/ in the kernel sources
I was assuming rb_erase() was setting things up like list_del_init, but the fact that thread__delete() was being sucessfull is because the last thing before deleting is to remove the thread from the machine->dead_threads list, using list_del_init(), that has the same effect as using rb_erase_init()...
Introduce this function so that we can use it when removing objects from rb_trees.
Then we will be able to BUG_ON(still on a list) in destructors.
Cc Adrian Hunter <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc David Ahern <[email protected]>
Cc Don Zickus <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Stephane Eranian <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/util/include/linux/rbtree.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
tools/perf/util/include/linux/rbtree.h +14 -0
@@ -1,2 +1,16 @@ +#ifndef __TOOLS_LINUX_PERF_RBTREE_H +#define __TOOLS_LINUX_PERF_RBTREE_H#include <stdbool.h> #include "../../../../include/linux/rbtree.h" + +/* +* Handy for checking that we are not deleting an entry that is +* already in a list, found in block/{blk-throttle,cfq-iosched}.c, +* probably should be moved to lib/rbtree.c... +*/ +static inline void rb_erase_init (struct rb_node *n,struct rb_root *root) +{ +rb_erase (n, root); +RB_CLEAR_NODE (n); +} +#endif /* __TOOLS_LINUX_PERF_RBTREE_H */