diff options
author | Michel Lespinasse <walken@google.com> | 2012-10-08 19:31:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-09 03:22:40 -0400 |
commit | 9c079add0d0f45220f4bb37febf0621137ec2d38 (patch) | |
tree | ce6ba6d7e2d517a2004de856c882f2a08af12be2 /Documentation | |
parent | 147e615f83c2c36caf89e7a3bf78090ade6f266c (diff) |
rbtree: move augmented rbtree functionality to rbtree_augmented.h
Provide rb_insert_augmented() and rb_erase_augmented() through a new
rbtree_augmented.h include file. rb_erase_augmented() is defined there as
an __always_inline function, in order to allow inlining of augmented
rbtree callbacks into it. Since this generates a relatively large
function, each augmented rbtree user should make sure to have a single
call site.
Signed-off-by: Michel Lespinasse <walken@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Hillf Danton <dhillf@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/rbtree.txt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Documentation/rbtree.txt b/Documentation/rbtree.txt index 0a0b6dce3e08..61b6c48871a0 100644 --- a/Documentation/rbtree.txt +++ b/Documentation/rbtree.txt | |||
@@ -202,6 +202,14 @@ An rbtree user who wants this feature will have to call the augmentation | |||
202 | functions with the user provided augmentation callback when inserting | 202 | functions with the user provided augmentation callback when inserting |
203 | and erasing nodes. | 203 | and erasing nodes. |
204 | 204 | ||
205 | C files implementing augmented rbtree manipulation must include | ||
206 | <linux/rbtree_augmented.h> instead of <linus/rbtree.h>. Note that | ||
207 | linux/rbtree_augmented.h exposes some rbtree implementations details | ||
208 | you are not expected to rely on; please stick to the documented APIs | ||
209 | there and do not include <linux/rbtree_augmented.h> from header files | ||
210 | either so as to minimize chances of your users accidentally relying on | ||
211 | such implementation details. | ||
212 | |||
205 | On insertion, the user must update the augmented information on the path | 213 | On insertion, the user must update the augmented information on the path |
206 | leading to the inserted node, then call rb_link_node() as usual and | 214 | leading to the inserted node, then call rb_link_node() as usual and |
207 | rb_augment_inserted() instead of the usual rb_insert_color() call. | 215 | rb_augment_inserted() instead of the usual rb_insert_color() call. |
@@ -227,6 +235,11 @@ In both cases, the callbacks are provided through struct rb_augment_callbacks. | |||
227 | subtree to a newly assigned subtree root AND recomputes the augmented | 235 | subtree to a newly assigned subtree root AND recomputes the augmented |
228 | information for the former subtree root. | 236 | information for the former subtree root. |
229 | 237 | ||
238 | The compiled code for rb_erase_augmented() may inline the propagation and | ||
239 | copy callbacks, which results in a large function, so each augmented rbtree | ||
240 | user should have a single rb_erase_augmented() call site in order to limit | ||
241 | compiled code size. | ||
242 | |||
230 | 243 | ||
231 | Sample usage: | 244 | Sample usage: |
232 | 245 | ||