I was going through an article on linux kernel radix tree implementation, link of article is mentioned below:
http://lwn.net/Articles/175432/
In this article it mentions that radix_tree_preload allocates sufficient memory so that the subsequent insertion in tree will not fail. Although it allocates the structures on per-CPU basis and hence the function returns with preemption disabled. It is the reponsibility of the caller to call radix_tree_preload_end in order to enable the preemption.
My question is:
1) Why radix_tree_preload allocates the structure on per-CPU basis?
2) When is the user supposed to call radix_tree_preload_end? Is it immediately after radix_tree_insert?
3) Does it not affect the performance as the radix trees are used for page cache operations and hence any insertion will cause the preemption to be disabled? Correct me if my understanding is wrong.