Linux ??????????Radix ??
???????????? ???????[ 2015/8/26 13:17:34 ] ??????????????
?????????????????? Linux ????????????????????????????????????????????????????????????????? Radix tree??Linux ???????????????? radix tree ?????? API ????
????include/linux/radix-tree.h
????lib/radix-tree.c
?????????????????? radix tree ??Radix tree ????? ??? trie?? trie ??????????????????饗associative array?????? ?????-???key-value?? ?洢?????????????????????????????????????????????????????? Trie ????????? n-tree ??????????в????洢????????????????洢?????????????????????????????????????????????????????????????????????????????????????????
????????????У??????????? trie ???洢????????? go ?? cat????? trie ?? radix tree ?? trie ??????????????????????????м??????????
????Linux ????е? Radix ??????????????????Radix ????????????? include/linux/radix-tree.h ????? :
????struct radix_tree_root {
????unsigned int height;
????gfp_t gfp_mask;
????struct radix_tree_node __rcu *rnode;
????};
????????????? radix ???? root ??????壬???????????????
????height????????????????????????
????gfp_mask??????????????
????rnode?????????
????????????????????????? gfp_mask :
????Linux ?????????????????????????flag?? – gfp_mask ???????????????????????????? GFP_ ????????????????????????????GFP_NOIO ??????? IO ?????????????????棬__GFP_HIGHMEM ????????????????棬GFP_ATOMIC ??????????????????????????????
????????????????????? rnode??
????struct radix_tree_node {
????unsigned int path;
????unsigned int count;
????union {
????struct {
????struct radix_tree_node *parent;
????void *private_data;
????};
????struct rcu_head rcu_head;
????};
????/* For tree user */
????struct list_head private_list;
????void __rcu *slots[RADIX_TREE_MAP_SIZE];
????unsigned long tags[RADIX_TREE_MAX_TAGS][RADIX_TREE_TAG_LONGS];
????};
????????????а????????????????????????????????????????????????????洢?????????????????£?
????path????????????????????????
????count????????????
????parent???????????
????private_data???洢???????????????
????rcu_head???????????? RCU ?????
????private_list – ?洢?????
???????? radix_tree_node ?????????? tags ?? slots ??????????????????????? Radix ??????????????????洢???????? slots ????????? slots ???????? NULL?? Linux ???? Radix ???????л??????????????洢?????? tags ???????????λ?????? Radix ????????洢????
???????????????? radix ?????????????????? radix ???????? API??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11