diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-11-01 12:08:38 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-11-01 12:48:04 +0200 |
| commit | a126211922d817cd1c4636c26d4a9a8b1b5f381f (patch) | |
| tree | e930b224af3cc5f572f289488b7a87b03d6bf96e /arch | |
| parent | 83ec75327c1ec35f25b6aee24f616a41858be539 (diff) | |
| download | kmi-a126211922d817cd1c4636c26d4a9a8b1b5f381f.tar.gz kmi-a126211922d817cd1c4636c26d4a9a8b1b5f381f.zip | |
copy rpc stacks directly
+ Speeds up fork a little bit
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/riscv64/kernel/vmem.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/arch/riscv64/kernel/vmem.c b/arch/riscv64/kernel/vmem.c index 4556593..a215208 100644 --- a/arch/riscv64/kernel/vmem.c +++ b/arch/riscv64/kernel/vmem.c @@ -581,21 +581,13 @@ size_t max_rpc_size() void copy_rpc_stack(struct tcb *t, struct tcb *c) { - /* this is of terrible, copying 2MiB for every fork, not - * great. TODO: use the direct pointer to the rpc stack element? */ - for (size_t i = 0; i < rpc_pages; ++i) { - pm_t p1, p2; - stat_t ok1 = stat_vpage(t->rpc.vmem, - RPC_STACK_BASE + BASE_PAGE_SIZE * i, - &p1, NULL, NULL); + pm_t *pte1 = (pm_t *)t->arch.rpc_leaf; + pm_t page1 = (pm_t)pte_addr(*pte1); - stat_t ok2 = stat_vpage(c->rpc.vmem, - RPC_STACK_BASE + BASE_PAGE_SIZE * i, - &p2, NULL, NULL); + pm_t *pte2 = (pm_t *)c->arch.rpc_leaf; + pm_t page2 = (pm_t)pte_addr(*pte2); - assert(ok1 == OK && ok2 == OK); - memcpy((void *)p2, (void *)p1, BASE_PAGE_SIZE); - } + memcpy((void *)page2, (void *)page1, order_size(MM_O1)); } stat_t setup_rpc_stack(struct tcb *t) |
