Wang, Wei W wrote:
If you read what radix_tree_node_alloc() is doing, you will find thatWei Wang wrote:It also mentions that the preload attempts to allocate sufficient memory to *guarantee* that the next radix tree insertion cannot fail.
According to https://lwn.net/Articles/175432/ , I think that preloading isBut passing GFP_NOWAIT means that we can handle allocation failure.I think the reason we need xb_preload is because radix tree insertion
There is no need to use preload approach when we can handle allocation failure.
needs the memory being preallocated already (it couldn't suffer from
memory failure during the process of inserting, probably because
handling the failure there isn't easy, Matthew may know the backstory
of
this)
needed only when failure to insert an item into a radix tree is a significant
problem.
That is, when failure to insert an item into a radix tree is not a problem, I
think that we don't need to use preloading.
If we check radix_tree_node_alloc(), the comments there says "this assumes that the caller has performed appropriate preallocation".
radix_tree_node_alloc() returns NULL when memory allocation failed.
I think that "this assumes that the caller has performed appropriate preallocation"
means "The caller has to perform appropriate preallocation if the caller does not
want radix_tree_node_alloc() to return NULL".