On Fri, Mar 13, 2020 at 05:06:59AM +0000, George Spelvin wrote: > I'd just like to mention that the is_vmalloc_addr() test depends only on > the virtual address, so can be done when the memory is queued, before the > grace period. That is, you could have kfree_rcu(), vfree_rcu(), and a > kvfree_rcu() function which decides between them. > > One advantage of that would be that you could put the vfree() sanity > checks into vfree_rcu(), so errors would have a useful backtrace, > and just do the __vunmap when the grace period expires. > > Or you could build a mixed queue and do the is_vmalloc_addr() test at > the end of the grace period. That was my original idea, because it > avoids the need for a separate queue. (In the _rcu_bulk_data structure, > you can do a quicksort-style partitioning on is_vmalloc_addr(), so > the kfree_bulk() pointers are all contiguous.) > > Just an implementation option. I would guess that sorting them before the grace period might improve cache locality and thus performance. So it does seem like an excellent thing to try, at the very least as an experiment. Thanx, Paul