[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100113142800.GC5036@nowhere>
Date: Wed, 13 Jan 2010 15:28:01 +0100
From: Frederic Weisbecker <fweisbec@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Arnaldo Carvalho de Melo <acme@...radead.org>,
Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
Mike Galbraith <efault@....de>,
Paul Mackerras <paulus@...ba.org>
Subject: Re: [PATCH 1/3] rbtree: Introduce rb_for_each_entry
On Wed, Jan 13, 2010 at 03:18:16PM +0100, Peter Zijlstra wrote:
> On Wed, 2010-01-13 at 12:13 -0200, Arnaldo Carvalho de Melo wrote:
> > Em Wed, Jan 13, 2010 at 02:58:53PM +0100, Peter Zijlstra escreveu:
> > > On Wed, 2010-01-13 at 11:52 -0200, Arnaldo Carvalho de Melo wrote:
> > > > Em Wed, Jan 13, 2010 at 02:34:45PM +0100, Frederic Weisbecker escreveu:
> > > > > At least it matches many patterns in perf :)
> > > >
> > > > What an insane piece of... software! 8-) Whatever, if it makes Peter
> > > > happy we can keep it on tools/perf/util/include/linux/rbtree.h, just
> > > > after the:
> > > >
> > > > #include "../../../../include/linux/rbtree.h"
> > > >
> > > > ;-)
> > > >
> > > > Just like we have list_del_range() in tools/perf/util/include/linux/list.h.
> > >
> > > That's not the point, doing a for_each on the rb-trees as we have today
> > > is a O(n log(n)) operation, not something you should want to do often.
> > >
> > > Adding a helper promotes the idea that its a sane thing to do, its not.
> > >
> > > If you really need it, open coding it isn't hard, but the lack of helper
> > > does make you think and hopefully realize you're doing something funny.
> >
> > We need it in several places in the perf tools, to present sorted results, to
> > dump the maps for debugging purposes, etc.
> >
> > But I'll go and look at each one of them to see if there is any where it
> > is used in some stupid way.
>
> Sure, but again, that's missing the point, adding that helper isn't a
> good thing. We have no 64bit division operators in Linux either, for the
> very same reason.
>
I don't understand why this is unsane. Sure it is O(n log(n)), but
that's what is suitable for our use in perf. Shouldn't we simplify
it through a helper just because it's not something sane in most
other cases?
But yeah, such helper inside the kernel wouldn't be sane, as it
wouldn't fit any sane need I guess.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists