From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wilson Subject: Re: [PATCH 1/3] lib: Always build and export interval_tree Date: Sun, 26 Jan 2014 11:27:59 +0000 Message-ID: <20140126112759.GD23557@nuc-i3427.alporthouse.com> References: <1390316872-15887-1-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from fireflyinternet.com (mail.fireflyinternet.com [87.106.93.118]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E93DFA3B4 for ; Sun, 26 Jan 2014 03:28:58 -0800 (PST) Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Michel Lespinasse Cc: Andrea Arcangeli , Rik van Riel , Peter Zijlstra , intel-gfx@lists.freedesktop.org, Akash Goel , Andrew Morton List-Id: intel-gfx@lists.freedesktop.org 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 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 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