Redesign reschedule points, allow one operation to reschedule many cpus at once
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m12s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m12s
This commit is contained in:
32
kernel/proc/reschedule.c
Normal file
32
kernel/proc/reschedule.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <libk/list.h>
|
||||
#include <mm/liballoc.h>
|
||||
#include <proc/reschedule.h>
|
||||
#include <sync/spin_lock.h>
|
||||
#include <sys/smp.h>
|
||||
|
||||
void reschedule_list_append (struct reschedule_ctx* rctx, struct cpu* cpu) {
|
||||
spin_lock (&rctx->lock);
|
||||
|
||||
struct list_node_link *node, *tmp;
|
||||
list_foreach (rctx->entries, node, tmp) {
|
||||
struct reschedule_entry* entry = list_entry (node, struct reschedule_entry, link);
|
||||
|
||||
if (entry->cpu == cpu) {
|
||||
spin_unlock (&rctx->lock);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
struct reschedule_entry* entry = malloc (sizeof (*entry));
|
||||
|
||||
if (entry == NULL) {
|
||||
spin_unlock (&rctx->lock);
|
||||
return;
|
||||
}
|
||||
|
||||
entry->cpu = cpu;
|
||||
|
||||
list_append (rctx->entries, &entry->link);
|
||||
|
||||
spin_unlock (&rctx->lock);
|
||||
}
|
||||
Reference in New Issue
Block a user