summaryrefslogtreecommitdiff
path: root/src/kernel/proc.c
diff options
context:
space:
mode:
authordzwdz2022-08-03 12:42:52 +0200
committerdzwdz2022-08-03 12:42:52 +0200
commitd9da70c7c6230b9698dc4a1dbc4d7f05794d2740 (patch)
treeafa28cfc7069f7649632f7b33daac47ee56d3819 /src/kernel/proc.c
parent092f732b893c3ecc0f8cee6699ab21ea42ad10ff (diff)
kernel: reuse a single allocation for all vfs_requests of a process
$ iostress 32 512 0 > /vtty # before 512 calls, 0 bytes. avg 121133 $ iostress 32 512 0 > /vtty # after 512 calls, 0 bytes. avg 103540 103540/121133 = ~85% I think the tiny bit of added complexity is worth it here.
Diffstat (limited to 'src/kernel/proc.c')
-rw-r--r--src/kernel/proc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
index a8cf303..e7a5ed6 100644
--- a/src/kernel/proc.c
+++ b/src/kernel/proc.c
@@ -114,8 +114,13 @@ void process_kill(struct process *p, int ret) {
p->controlled = NULL;
}
- if (p->state == PS_WAITS4FS)
- p->waits4fs.req->caller = NULL;
+ if (p->state == PS_WAITS4FS) {
+ assert(p->reqslot);
+ p->reqslot->caller = NULL; /* transfer ownership */
+ p->reqslot = NULL;
+ } else if (p->reqslot) {
+ kfree(p->reqslot);
+ }
if (p->state == PS_WAITS4PIPE) {
struct process **iter = &p->waits4pipe.pipe->pipe.queued;