diff options
author | Sasha Levin <levinsasha928@gmail.com> | 2011-07-24 04:23:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-24 13:03:05 -0400 |
commit | 2f175074e6811974ee77ddeb026f4d21aa3eca4d (patch) | |
tree | 845cb1cc70e52bef69b9848578be720ce3d34a2a /Documentation/rbtree.txt | |
parent | 81d67439855a7f928d90965d832aa4f2fb677342 (diff) |
Documentation: Update augmented rbtree documentation
Current documentation referred to the old method of handling augmented
trees. Update documentation to correspond with the changes done in
commit b945d6b2554d ("rbtree: Undo augmented trees performance damage
and regression").
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: David Woodhouse <David.Woodhouse@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/rbtree.txt')
-rw-r--r-- | Documentation/rbtree.txt | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Documentation/rbtree.txt b/Documentation/rbtree.txt index 19f8278c3854..8d32d85a5234 100644 --- a/Documentation/rbtree.txt +++ b/Documentation/rbtree.txt | |||
@@ -196,15 +196,20 @@ Support for Augmented rbtrees | |||
196 | Augmented rbtree is an rbtree with "some" additional data stored in each node. | 196 | Augmented rbtree is an rbtree with "some" additional data stored in each node. |
197 | This data can be used to augment some new functionality to rbtree. | 197 | This data can be used to augment some new functionality to rbtree. |
198 | Augmented rbtree is an optional feature built on top of basic rbtree | 198 | Augmented rbtree is an optional feature built on top of basic rbtree |
199 | infrastructure. rbtree user who wants this feature will have an augment | 199 | infrastructure. An rbtree user who wants this feature will have to call the |
200 | callback function in rb_root initialized. | 200 | augmentation functions with the user provided augmentation callback |
201 | 201 | when inserting and erasing nodes. | |
202 | This callback function will be called from rbtree core routines whenever | 202 | |
203 | a node has a change in one or both of its children. It is the responsibility | 203 | On insertion, the user must call rb_augment_insert() once the new node is in |
204 | of the callback function to recalculate the additional data that is in the | 204 | place. This will cause the augmentation function callback to be called for |
205 | rb node using new children information. Note that if this new additional | 205 | each node between the new node and the root which has been affected by the |
206 | data affects the parent node's additional data, then callback function has | 206 | insertion. |
207 | to handle it and do the recursive updates. | 207 | |
208 | When erasing a node, the user must call rb_augment_erase_begin() first to | ||
209 | retrieve the deepest node on the rebalance path. Then, after erasing the | ||
210 | original node, the user must call rb_augment_erase_end() with the deepest | ||
211 | node found earlier. This will cause the augmentation function to be called | ||
212 | for each affected node between the deepest node and the root. | ||
208 | 213 | ||
209 | 214 | ||
210 | Interval tree is an example of augmented rb tree. Reference - | 215 | Interval tree is an example of augmented rb tree. Reference - |