Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1228842
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Ingo Molnar <mingo@kernel.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] perf tools: Use postorder rbtree iteration when removing symbols |
| Date | Sun, 20 Sep 2015 10:10:01 +0200 |
| Message-ID | <qaHR7-2vO-5@gated-at.bofh.it> (permalink) |
| References | <qaq3T-2gi-9@gated-at.bofh.it> |
| X-Original-To | Alex Snast <asnast@gmail.com> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=H+YFE7ovgWVWmesq4JQtElD49zBo+X4IRL96aFWS42E=; b=ksOzRTkoAF8iDlIEje4gkQJt8EjQAMH8sSjacNEoaWRLM5baET34WA73dAZHfUXk+e tCb4D82SI3KjxM5aoXDyFRzB3API6UQ61n+fCkgLCnG2ycZUAiM71phruACNEC8ce1uq Lxzue6P1pEsE4X0FREvrBMAo1emnTQxXwsf6R1KoXHFSKfAujimaDDn92kBIi/yAcjsi j3M1yqOXbadYmoFARCYtryUc+WnUHjgHIs73Hytr6VXtscDo7MEQvNYocwbg/zPYSvy0 LfS9Jlh46xnf9hZ7r+/HzjkzeuklAewUatrMDRqPNJlR2OOtuzutGa+snQwzQ098pGYc Uf0A== |
| X-Received | by 10.180.188.12 with SMTP id fw12mr7544804wic.69.1442736323850; Sun, 20 Sep 2015 01:05:23 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.23 (2014-03-12) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 62 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Arnaldo Carvalho de Melo <acme@kernel.org>, Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <a.p.zijlstra@chello.nl>, linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>, Adrian Hunter <adrian.hunter@intel.com>, Namhyung Kim <namhyung@kernel.org> |
| X-Original-Date | Sun, 20 Sep 2015 10:05:20 +0200 |
| X-Original-Message-ID | <20150920080519.GA8234@gmail.com> |
| X-Original-References | <1442667815-10749-1-git-send-email-asnast@gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1228842 |
Show key headers only | View raw
* Alex Snast <asnast@gmail.com> wrote:
> Avoid using rb_erase when removing symbols as it requires rbtree
> rebalancing, instead preform a post order iteration when deleting tree
> symbols.
>
> Signed-off-by: Alex Snast <asnast@gmail.com>
> ---
> tools/include/linux/rbtree.h | 14 ++++++++++++++
> tools/perf/util/symbol.c | 11 ++++-------
> 2 files changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/tools/include/linux/rbtree.h b/tools/include/linux/rbtree.h
> index 1125822..14c646d 100644
> --- a/tools/include/linux/rbtree.h
> +++ b/tools/include/linux/rbtree.h
> @@ -90,6 +90,20 @@ static inline void rb_link_node(struct rb_node *node, struct rb_node *parent,
> ____ptr ? rb_entry(____ptr, type, member) : NULL; \
> })
>
> +/**
> + * rbtree_postorder_for_each_entry_safe - iterate over rb_root in post order of
> + * given type safe against removal of rb_node entry
> + *
> + * @pos: the 'type *' to use as a loop cursor.
> + * @n: another 'type *' to use as temporary storage
> + * @root: 'rb_root *' of the rbtree.
> + * @field: the name of the rb_node field within 'type'.
> + */
> +#define rbtree_postorder_for_each_entry_safe(pos, n, root, field) \
> + for (pos = rb_entry_safe(rb_first_postorder(root), typeof(*pos), field); \
> + pos && ({ n = rb_entry_safe(rb_next_postorder(&pos->field), \
> + typeof(*pos), field); 1; }); \
> + pos = n)
So looks like this is something that include/linux/rbtree.h already has, right?
I think we should strive to match the two implementations and generate a build
time warning (but not a build time failure) if the two diverge.
There were checking facilities added recently for another kernel source code file,
to make sure tools/perf/util/intel-pt-decoder/insn.c matches arch/x86/lib/insn.c.
Btw., side note, regarding insn.c, the remaining delta between the two files:
-#include <asm/inat.h>
-#include <asm/insn.h>
+#include "inat.h"
+#include "insn.h"
should be eliminated too I think, to make it more obvious when the two versions
match.
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/2] perf tools: Use postorder rbtree iteration when removing symbols Alex Snast <asnast@gmail.com> - 2015-09-19 15:10 +0200
[PATCH 2/2] perf tools: Use rb_entry_safe on first / next symbol lookup Alex Snast <asnast@gmail.com> - 2015-09-19 15:10 +0200
Re: [PATCH 1/2] perf tools: Use postorder rbtree iteration when removing symbols Ingo Molnar <mingo@kernel.org> - 2015-09-20 10:10 +0200
Re: [PATCH 1/2] perf tools: Use postorder rbtree iteration when removing symbols Ingo Molnar <mingo@kernel.org> - 2015-09-21 09:20 +0200
csiph-web