From b36e3b83b402ee054c319f0472b16a2bd64bba7e Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 13 Nov 2022 07:28:52 +0200 Subject: ~1.3M ipc requests + The secret is using gravestones. I'll have to write up full documentation for the feature but essentially riscv lets us encode whatever we want into page table entries, as long as they're not active. We use this to encode highest user address that is not a zero, in that all entries in the top level are either active or gravestones. When an active entry is removed, it is either a gravestone (if there are other active entries above it) or it starts a cascade of removing entries that have been previously removed Slight runtime overhead to page mapping, pretty major advantage in rpc calls. Feature will need to be tested more thorougly, and the init program is sort of a best scenario with just one top level userspace page table entry active at a time, leading to incredibly fast context switches. Current implementation limits a process' max virtual memory to 248 GiB (in Sv39), but I don't think the missing 8 GiB is that big of a deal. --- common/tcb.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'common/tcb.c') diff --git a/common/tcb.c b/common/tcb.c index f774fbc..201b15e 100644 --- a/common/tcb.c +++ b/common/tcb.c @@ -344,11 +344,8 @@ stat_t clone_rpc_maps(struct tcb *r) { hard_assert(r && is_proc(r), ERR_INVAL); struct tcb *t = r; - while ((t = t->rpc.next)) { - stat_t ret = clone_uvmem(r->proc.vmem, t->rpc.vmem); - if (ret) - return ret; - } + while ((t = t->rpc.next)) + clone_uvmem(r->proc.vmem, t->rpc.vmem); return OK; } @@ -357,11 +354,8 @@ stat_t clone_proc_maps(struct tcb *r) { hard_assert(r && is_proc(r), ERR_INVAL); struct tcb *t = r; - while ((t = t->proc.next)) { - stat_t ret = clone_uvmem(r->proc.vmem, t->proc.vmem); - if (ret) - return ret; - } + while ((t = t->proc.next)) + clone_uvmem(r->proc.vmem, t->proc.vmem); return OK; } -- cgit v1.3