/openbmc/linux/lib/ |
H A D | radix-tree.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 24 #include <linux/radix-tree.h> 30 #include "radix-tree.h" 33 * Radix tree node cache. 38 * The radix tree is variable-height, so an insert operation not only has 45 * of RADIX_TREE_MAX_PATH size to be created, with only the root node shared. 48 #define RADIX_TREE_PRELOAD_SIZE (RADIX_TREE_MAX_PATH * 2 - 1) 54 #define IDR_INDEX_BITS (8 /* CHAR_BIT */ * sizeof(int) - 1) 57 #define IDR_PRELOAD_SIZE (IDR_MAX_PATH * 2 - 1) 60 * Per-cpu pool of preloaded nodes [all …]
|
H A D | rbtree_test.c | 1 // SPDX-License-Identifier: GPL-2.0-only 14 __param(int, nnodes, 100, "Number of nodes in the rb-tree"); 15 __param(int, perf_loops, 1000, "Number of iterations modifying the rb-tree"); 16 __param(int, check_loops, 100, "Number of iterations modifying and verifying the rb-tree"); 27 static struct rb_root_cached root = RB_ROOT_CACHED; variable 32 static void insert(struct test_node *node, struct rb_root_cached *root) in insert() argument 34 struct rb_node **new = &root->rb_root.rb_node, *parent = NULL; in insert() 35 u32 key = node->key; in insert() 39 if (key < rb_entry(parent, struct test_node, rb)->key) in insert() 40 new = &parent->rb_left; in insert() [all …]
|
H A D | rbtree.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 16 * red-black trees properties: https://en.wikipedia.org/wiki/Rbtree 18 * 1) A node is either red or black 19 * 2) The root is black 21 * 4) Both children of every red node are black 22 * 5) Every simple path from root to leaves contains the same number 26 * consecutive red nodes in a path and every red node is therefore followed by 42 * These two requirements will allow lockless iteration of the tree -- not 47 * and that it will indeed complete -- does not get stuck in a loop. 61 rb->__rb_parent_color += RB_BLACK; in rb_set_black() [all …]
|
H A D | bootconfig.c | 1 // SPDX-License-Identifier: GPL-2.0 17 /* embedded_bootconfig_data is defined in bootconfig-data.S */ 23 *size = embedded_bootconfig_data_end - embedded_bootconfig_data; in xbc_get_embedded_bootconfig() 40 * Extra Boot Config (XBC) is given as tree-structured ascii text of 41 * key-value pairs on memory. 42 * xbc_parse() parses the text to build a simple tree. Each tree node is 43 * simply a key word or a value. A key node may have a next key node or/and 44 * a child node (both key and value). A value node may have a next value 45 * node (for array). 85 * xbc_get_info() - Get the information of loaded boot config [all …]
|
/openbmc/linux/scripts/gdb/linux/ |
H A D | rbtree.py | 1 # SPDX-License-Identifier: GPL-2.0 13 def rb_first(root): argument 14 if root.type == rb_root_type.get_type(): 15 node = root.address.cast(rb_root_type.get_type().pointer()) 16 elif root.type != rb_root_type.get_type().pointer(): 17 raise gdb.GdbError("Must be struct rb_root not {}".format(root.type)) 19 node = root['rb_node'] 20 if node == 0: 23 while node['rb_left']: 24 node = node['rb_left'] [all …]
|
H A D | radixtree.py | 1 # SPDX-License-Identifier: GPL-2.0 20 def is_internal_node(node): argument 22 …return ((node.cast(long_type) & constants.LX_RADIX_TREE_ENTRY_MASK) == constants.LX_RADIX_TREE_INT… 24 def entry_to_node(node): argument 26 node_type = node.type 27 indirect_ptr = node.cast(long_type) & ~constants.LX_RADIX_TREE_INTERNAL_NODE 30 def node_maxindex(node): argument 31 return (constants.LX_RADIX_TREE_MAP_SIZE << node['shift']) - 1 33 def lookup(root, index): argument 34 if root.type == radix_tree_root_type.get_type().pointer(): [all …]
|
/openbmc/linux/include/linux/ |
H A D | rbtree_latch.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 3 * Latched RB-trees 7 * Since RB-trees have non-atomic modifications they're not immediately suited 8 * for RCU/lockless queries. Even though we made RB-tree lookups non-fatal for 11 * The simplest solution is a seqlock + RB-tree, this will allow lockless 17 * employing the latch technique -- see @raw_write_seqcount_latch -- to 18 * implement a latched RB-tree which does allow for unconditional lookups by 26 * Therefore, this does require a lockless RB-tree iteration to be non-fatal; 28 * condition -- not seeing partial stores -- because the latch thing isolates 41 struct rb_node node[2]; member [all …]
|
H A D | rbtree.h | 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 14 See Documentation/core-api/rbtree.rst for documentation and samples. 26 #define rb_parent(r) ((struct rb_node *)((r)->__rb_parent_color & ~3)) 30 #define RB_EMPTY_ROOT(root) (READ_ONCE((root)->rb_node) == NULL) argument 33 #define RB_EMPTY_NODE(node) \ argument 34 ((node)->__rb_parent_color == (unsigned long)(node)) 35 #define RB_CLEAR_NODE(node) \ argument 36 ((node)->__rb_parent_color = (unsigned long)(node)) 49 /* Postorder iteration - always visit the parent after its children */ 53 /* Fast replacement of a single node without remove/rebalance/add/rebalance */ [all …]
|
H A D | rbtree_augmented.h | 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 20 * Please note - only struct rb_augment_callbacks and the prototypes for 24 * See Documentation/core-api/rbtree.rst for documentation and samples. 28 void (*propagate)(struct rb_node *node, struct rb_node *stop); 33 extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root, 40 * leading to the inserted node, then call rb_link_node() as usual and 47 rb_insert_augmented(struct rb_node *node, struct rb_root *root, in rb_insert_augmented() argument 50 __rb_insert_augmented(node, root, augment->rotate); in rb_insert_augmented() 54 rb_insert_augmented_cached(struct rb_node *node, in rb_insert_augmented_cached() argument 55 struct rb_root_cached *root, bool newleft, in rb_insert_augmented_cached() argument [all …]
|
H A D | interval_tree_generic.h | 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 18 * ITSUBTREE: name of ITTYPE field within ITSTRUCT holding last-in-subtree 19 * ITSTART(n): start endpoint of ITSTRUCT node n 20 * ITLAST(n): last endpoint of ITSTRUCT node n 24 * Note - before using this, please consider if generic version 38 ITSTATIC void ITPREFIX ## _insert(ITSTRUCT *node, \ 39 struct rb_root_cached *root) \ 41 struct rb_node **link = &root->rb_root.rb_node, *rb_parent = NULL; \ 42 ITTYPE start = ITSTART(node), last = ITLAST(node); \ 49 if (parent->ITSUBTREE < last) \ [all …]
|
/openbmc/u-boot/lib/ |
H A D | rbtree.c | 1 // SPDX-License-Identifier: GPL-2.0+ 18 * red-black trees properties: http://en.wikipedia.org/wiki/Rbtree 20 * 1) A node is either red or black 21 * 2) The root is black 23 * 4) Both children of every red node are black 24 * 5) Every simple path from root to leaves contains the same number 28 * consecutive red nodes in a path and every red node is therefore followed by 39 rb->__rb_parent_color |= RB_BLACK; in rb_set_black() 44 return (struct rb_node *)red->__rb_parent_color; in rb_red_parent() 49 * - old's parent and color get assigned to new [all …]
|
/openbmc/linux/tools/lib/ |
H A D | rbtree.c | 1 // SPDX-License-Identifier: GPL-2.0-or-later 16 * red-black trees properties: https://en.wikipedia.org/wiki/Rbtree 18 * 1) A node is either red or black 19 * 2) The root is black 21 * 4) Both children of every red node are black 22 * 5) Every simple path from root to leaves contains the same number 26 * consecutive red nodes in a path and every red node is therefore followed by 42 * These two requirements will allow lockless iteration of the tree -- not 47 * and that it will indeed complete -- does not get stuck in a loop. 61 rb->__rb_parent_color |= RB_BLACK; in rb_set_black() [all …]
|
/openbmc/linux/fs/btrfs/ |
H A D | delayed-inode.c | 1 // SPDX-License-Identifier: GPL-2.0 13 #include "delayed-inode.h" 14 #include "disk-io.h" 18 #include "inode-item.h" 19 #include "space-info.h" 21 #include "file-item.h" 37 return -ENOMEM; in btrfs_delayed_inode_init() 48 struct btrfs_root *root, u64 inode_id) in btrfs_init_delayed_node() argument 50 delayed_node->root = root; in btrfs_init_delayed_node() 51 delayed_node->inode_id = inode_id; in btrfs_init_delayed_node() [all …]
|
H A D | relocation.c | 1 // SPDX-License-Identifier: GPL-2.0 12 #include <linux/error-injection.h> 14 #include "disk-io.h" 19 #include "async-thread.h" 20 #include "free-space-cache.h" 22 #include "print-tree.h" 23 #include "delalloc-space.h" 24 #include "block-group.h" 29 #include "inode-item.h" 30 #include "space-info.h" [all …]
|
H A D | misc.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 12 * Enumerate bits using enum autoincrement. Define the @name as the n-th bit. 48 return n != 0 && (n & (n - 1)) == 0; in is_power_of_two_u64() 67 static inline struct rb_node *rb_simple_search(struct rb_root *root, u64 bytenr) in rb_simple_search() argument 69 struct rb_node *node = root->rb_node; in rb_simple_search() local 72 while (node) { in rb_simple_search() 73 entry = rb_entry(node, struct rb_simple_node, rb_node); in rb_simple_search() 75 if (bytenr < entry->bytenr) in rb_simple_search() 76 node = node->rb_left; in rb_simple_search() 77 else if (bytenr > entry->bytenr) in rb_simple_search() [all …]
|
/openbmc/linux/tools/perf/util/ |
H A D | strfilter.c | 1 // SPDX-License-Identifier: GPL-2.0 19 static void strfilter_node__delete(struct strfilter_node *node) in strfilter_node__delete() argument 21 if (node) { in strfilter_node__delete() 22 if (node->p && !is_operator(*node->p)) in strfilter_node__delete() 23 zfree((char **)&node->p); in strfilter_node__delete() 24 strfilter_node__delete(node->l); in strfilter_node__delete() 25 strfilter_node__delete(node->r); in strfilter_node__delete() 26 free(node); in strfilter_node__delete() 33 strfilter_node__delete(filter->root); in strfilter__delete() 56 if (*(p - 1) == '\\' || (*p == '!' && *(p - 1) == '[')) { in get_token() [all …]
|
/openbmc/qemu/util/ |
H A D | interval-tree.c | 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 4 #include "qemu/interval-tree.h" 10 * For now, don't expose Linux Red-Black Trees separately, but retain the 18 * red-black trees properties: https://en.wikipedia.org/wiki/Rbtree 20 * 1) A node is either red or black 21 * 2) The root is black 23 * 4) Both children of every red node are black 24 * 5) Every simple path from root to leaves contains the same number 28 * consecutive red nodes in a path and every red node is therefore followed by 42 * These two requirements will allow lockless iteration of the tree -- not [all …]
|
/openbmc/linux/tools/include/linux/ |
H A D | rbtree.h | 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 14 See Documentation/core-api/rbtree.rst for documentation and samples. 34 #define rb_parent(r) ((struct rb_node *)((r)->__rb_parent_color & ~3)) 39 #define RB_EMPTY_ROOT(root) (READ_ONCE((root)->rb_node) == NULL) argument 42 #define RB_EMPTY_NODE(node) \ argument 43 ((node)->__rb_parent_color == (unsigned long)(node)) 44 #define RB_CLEAR_NODE(node) \ argument 45 ((node)->__rb_parent_color = (unsigned long)(node)) 58 /* Postorder iteration - always visit the parent after its children */ 62 /* Fast replacement of a single node without remove/rebalance/add/rebalance */ [all …]
|
H A D | rbtree_augmented.h | 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 22 * Please note - only struct rb_augment_callbacks and the prototypes for 26 * See Documentation/core-api/rbtree.rst for documentation and samples. 30 void (*propagate)(struct rb_node *node, struct rb_node *stop); 35 extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root, 42 * leading to the inserted node, then call rb_link_node() as usual and 49 rb_insert_augmented(struct rb_node *node, struct rb_root *root, in rb_insert_augmented() argument 52 __rb_insert_augmented(node, root, augment->rotate); in rb_insert_augmented() 56 rb_insert_augmented_cached(struct rb_node *node, in rb_insert_augmented_cached() argument 57 struct rb_root_cached *root, bool newleft, in rb_insert_augmented_cached() argument [all …]
|
H A D | interval_tree_generic.h | 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 18 * ITSUBTREE: name of ITTYPE field within ITSTRUCT holding last-in-subtree 19 * ITSTART(n): start endpoint of ITSTRUCT node n 20 * ITLAST(n): last endpoint of ITSTRUCT node n 24 * Note - before using this, please consider if generic version 38 ITSTATIC void ITPREFIX ## _insert(ITSTRUCT *node, \ 39 struct rb_root_cached *root) \ 41 struct rb_node **link = &root->rb_root.rb_node, *rb_parent = NULL; \ 42 ITTYPE start = ITSTART(node), last = ITLAST(node); \ 49 if (parent->ITSUBTREE < last) \ [all …]
|
/openbmc/linux/drivers/net/ethernet/mellanox/mlx5/core/ |
H A D | fs_core.c | 14 * - Redistributions of source code must retain the above 18 * - Redistributions in binary form must reproduce the above 353 static void del_hw_flow_table(struct fs_node *node); 354 static void del_hw_flow_group(struct fs_node *node); 355 static void del_hw_fte(struct fs_node *node); 356 static void del_sw_flow_table(struct fs_node *node); 357 static void del_sw_flow_group(struct fs_node *node); 358 static void del_sw_fte(struct fs_node *node); 359 static void del_sw_prio(struct fs_node *node); 360 static void del_sw_ns(struct fs_node *node); [all …]
|
/openbmc/qemu/include/qemu/ |
H A D | interval-tree.h | 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 12 * For now, don't expose Linux Red-Black Trees separately, but retain the 47 * @root: root of the tree. 51 static inline bool interval_tree_is_empty(const IntervalTreeRoot *root) in interval_tree_is_empty() argument 53 return root->rb_root.rb_node == NULL; in interval_tree_is_empty() 58 * @node: node to insert, 59 * @root: root of the tree. 61 * Insert @node into @root, and rebalance. 63 void interval_tree_insert(IntervalTreeNode *node, IntervalTreeRoot *root); 67 * @node: node to remove, [all …]
|
/openbmc/linux/drivers/block/drbd/ |
H A D | drbd_interval.c | 1 // SPDX-License-Identifier: GPL-2.0-only 7 * interval_end - return end of @node 10 sector_t interval_end(struct rb_node *node) in interval_end() argument 12 struct drbd_interval *this = rb_entry(node, struct drbd_interval, rb); in interval_end() 13 return this->end; in interval_end() 16 #define NODE_END(node) ((node)->sector + ((node)->size >> 9)) argument 22 * drbd_insert_interval - insert a new interval into a tree 25 drbd_insert_interval(struct rb_root *root, struct drbd_interval *this) in drbd_insert_interval() argument 27 struct rb_node **new = &root->rb_node, *parent = NULL; in drbd_insert_interval() 28 sector_t this_end = this->sector + (this->size >> 9); in drbd_insert_interval() [all …]
|
/openbmc/linux/mm/ |
H A D | interval_tree.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * mm/interval_tree.c - interval tree for mapping->i_mmap 15 return v->vm_pgoff; in vma_start_pgoff() 20 return v->vm_pgoff + vma_pages(v) - 1; in vma_last_pgoff() 27 /* Insert node immediately after prev in the interval tree */ 28 void vma_interval_tree_insert_after(struct vm_area_struct *node, in vma_interval_tree_insert_after() argument 30 struct rb_root_cached *root) in vma_interval_tree_insert_after() argument 34 unsigned long last = vma_last_pgoff(node); in vma_interval_tree_insert_after() 36 VM_BUG_ON_VMA(vma_start_pgoff(node) != vma_start_pgoff(prev), node); in vma_interval_tree_insert_after() 38 if (!prev->shared.rb.rb_right) { in vma_interval_tree_insert_after() [all …]
|
/openbmc/u-boot/include/linux/ |
H A D | rbtree_augmented.h | 1 /* SPDX-License-Identifier: GPL-2.0+ */ 18 * Please note - only struct rb_augment_callbacks and the prototypes for 26 void (*propagate)(struct rb_node *node, struct rb_node *stop); 31 extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root, 34 rb_insert_augmented(struct rb_node *node, struct rb_root *root, in rb_insert_augmented() argument 37 __rb_insert_augmented(node, root, augment->rotate); in rb_insert_augmented() 46 rbstruct *node = rb_entry(rb, rbstruct, rbfield); \ 47 rbtype augmented = rbcompute(node); \ 48 if (node->rbaugmented == augmented) \ 50 node->rbaugmented = augmented; \ [all …]
|