[Intel-gfx] [PATCH 1/3] lib: Always build and export interval_tree

Chris Wilson chris at chris-wilson.co.uk
Sun Jan 26 12:27:59 CET 2014


On Fri, Jan 24, 2014 at 08:42:18PM -0800, Michel Lespinasse wrote:
> Hi Chris,
> 
> On Tue, Jan 21, 2014 at 7:07 AM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> > lib/interval_tree.c provides a simple interface for an interval-tree
> > (an augmented red-black tree) but is only built when testing the generic
> > macros for building interval-trees. For drivers with modest needs,
> > export the simple interval-tree library as is.
> 
> Thanks for suggesting this. I did plan for this use case, and thought
> it would show up earlier.
> 
> My only concern is that I think we should keep the code under a config
> option (unless a use case shows up in core kernel). So I would
> suggest:
> 
> in lib/Kconfig:
> config INTERVAL_TREE
>        bool


+config INTERVAL_TREE
+       boolean
+        help
+          Simple, embeddable, interval-tree. Can find the start of an
+          overlapping range in log(n) time and then iterate over all
+          overlapping nodes. The algorithm is implemented as an
+          augmented rbtree.
+
+         See:
+
+               Documentation/rbtree.txt
+
+         for more information.

Though you probably have some better spiel. :)
 
> in lib/Kconfig.debug:
> make INTERVAL_TREE_TEST depend on m && DEBUG_KERNEL && INTERVAL_TREE

Done. Are you sure you do not just want to select INTERVAL_TREE here to
maintain the status quo?
 
> in lib/Makefile:
> obj-$(CONFIG_INTERVAL_TREE) += interval_tree.o
> 
> You would probably also need to add #include <linux/module.h> in
> lib/interval_tree.c to plan for that code being configured as a
> module.
> 
> Hope this helps,

Thanks!
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list