Le 11/10/2016 à 18:26, Joerg Sonnenberger a écrit :
On Tue, Oct 11, 2016 at 02:42:00PM +0200, Maxime Villard wrote:
All this to say that in pmap_enter_ma on x86, an optimization is possible. In
this function, new_pve and new_sparepve are always allocated, but not always
needed. The reason it is done this way is because preemption is disabled in the
critical part, so obviously the allocation needs to be performed earlier.
What happens if we cache a pair in curcpu? Basically, instead of the
pool get, check if curcpu already has one and take that out, at the end,
if the pair was unused, put it into curcpu.
I see what you mean, but I believe there is a locking issue. Fetching the
pointers from curcpu needs to be done with preemption disabled, but if we
find out the pointers are NULL then we need to allocate them, and it cannot
be done here anymore.