Skip to content

Commit

Permalink
Remove avl_size field from struct avl_tree
Browse files Browse the repository at this point in the history
This field is used only by illumos mdb.  On other platforms it only
increases the struct size from 32 to 40 bytes.  For struct vdev_queue
including 13 instances of avl_tree_t size means active cache lines.

Keep the padding in user-space for now to not break the ABI.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Signed-off-by: Alexander Motin <[email protected]>
Sponsored-By: iXsystems, Inc.
Closes #12290
  • Loading branch information
amotin authored Jul 1, 2021
1 parent 490c845 commit b192a2c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 3 additions & 1 deletion include/sys/avl_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ struct avl_tree {
int (*avl_compar)(const void *, const void *);
size_t avl_offset; /* offsetof(type, avl_link_t field) */
ulong_t avl_numnodes; /* number of nodes in the tree */
size_t avl_size; /* sizeof user type struct */
#ifndef _KERNEL
size_t avl_pad; /* For backwards ABI compatibility. */
#endif
};


Expand Down
2 changes: 0 additions & 2 deletions module/avl/avl.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,6 @@ avl_swap(avl_tree_t *tree1, avl_tree_t *tree2)

ASSERT3P(tree1->avl_compar, ==, tree2->avl_compar);
ASSERT3U(tree1->avl_offset, ==, tree2->avl_offset);
ASSERT3U(tree1->avl_size, ==, tree2->avl_size);

temp_node = tree1->avl_root;
temp_numnodes = tree1->avl_numnodes;
Expand Down Expand Up @@ -903,7 +902,6 @@ avl_create(avl_tree_t *tree, int (*compar) (const void *, const void *),
tree->avl_compar = compar;
tree->avl_root = NULL;
tree->avl_numnodes = 0;
tree->avl_size = size;
tree->avl_offset = offset;
}

Expand Down

0 comments on commit b192a2c

Please sign in to comment.