Support process-context identifiers
Page table switching is a significant part of context switch overhead, which process-context identifiers help reduce. With TLB shootdown now properly implemented, it would be a natural extension to add a percpu queue of Weak<AddrSpaceWrapper>
, and retain the address space CPU users bits set as long as they are still in that queue. PCIDs would only be used for userspace mappings, as the redox kernel memory layout makes a clear distinction between user and kernel addresses. An address space is user-accessible if and only if it's lower half, and if and only if it's non-Global.
If there are places where that makes sense (i.e. if a properly designed kernel can context switch to do kernel tasks for a non-kmain context, and then perhaps switch back without entering userspace), it would also be possible to implement delayed page table switching, where page tables are only switched when there are UserSlice
writes or when entering usermode. On Meltdown-mitigated systems (TODO), that might also reduce the number of page tables switches per IPC call from 4 to 3.
Because this may impact TLB shootdown performance, it would need to be benchmarked thoroughly before being enabled at least by default.