I just committed a diff that adds a little bit more mpsafeness to the sparc64 pmap. The commit message reads:
Make pmap_kenter_pa(9) and pmap_kremove(9) mpsafe. This required me to use atomic operations to operate on pm_stats.resident_count. Is it really necessary to keep track of that for the kernel pmap? I'd like to discuss that last question. Do we need to keep track of this for out kernel pmaps? The count is used mostly for keeping track of RSS for processes. That is fairly irrelevant for kernel threads. It's also used in the scheduler to estimate the cost of moving processes/threads from one CPU to another. I'm not sure that makes sense for kernel threads given that there seem to be huge differences in the accounting between architectures. For example my sparc64 system has an "RSS" of 166 MB whereas my amd64 system has only 18 MB. If we don't have to worry about about the stats for the kernel map, we might be able to avoid having to use atomic operations and the associated cost if there is contention. But we'll have to think about how this changes the scheduling of kernel threads.
