Hou Tao <houtao@xxxxxxxxxxxxxxx> writes: > Fix these warnings by replacing kmalloc()/kfree()/kfree_rcu() with > equivalent bpf memory allocator APIs. Since intermediate node and leaf > node have fixed sizes, fixed-size allocation APIs are used. > > Two aspects of this change require explanation: > > 1. A new flag LPM_TREE_NODE_FLAG_ALLOC_LEAF is added to track the > original allocator. This is necessary because during deletion, a leaf > node may be used as an intermediate node. These nodes must be freed > through the leaf allocator. > 2. The intermediate node allocator and leaf node allocator may be merged > because value_size for LPM trie is usually small. The merging reduces > the memory overhead of bpf memory allocator. This seems like an awfully complicated way to fix this. Couldn't we just move the node allocations in trie_update_elem() out so they happen before the trie lock is taken instead? -Toke