Fix CPU load balancer bugs, scheduling points support for remote CPUs
All checks were successful
Build documentation / build-and-deploy (push) Successful in 28s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 28s
This commit is contained in:
@@ -16,9 +16,10 @@
|
||||
#include <syscall/syscall.h>
|
||||
|
||||
#define DEFINE_SYSCALL(name) \
|
||||
uintptr_t name (struct proc* UNUSED proc, void* UNUSED regs, uintptr_t UNUSED a1, \
|
||||
uintptr_t UNUSED a2, uintptr_t UNUSED a3, uintptr_t UNUSED a4, \
|
||||
uintptr_t UNUSED a5, uintptr_t UNUSED a6)
|
||||
uintptr_t name (struct proc* UNUSED proc, void* UNUSED regs, bool* UNUSED reschedule, \
|
||||
struct cpu** UNUSED reschedule_cpu, uintptr_t UNUSED a1, uintptr_t UNUSED a2, \
|
||||
uintptr_t UNUSED a3, uintptr_t UNUSED a4, uintptr_t UNUSED a5, \
|
||||
uintptr_t UNUSED a6)
|
||||
|
||||
#define SYSRESULT(x) ((uintptr_t)(x))
|
||||
|
||||
@@ -44,7 +45,9 @@ static void* sys_get_user_buffer (struct proc* proc, uintptr_t uvaddr, size_t si
|
||||
|
||||
/* int quit (void) */
|
||||
DEFINE_SYSCALL (sys_quit) {
|
||||
proc_kill (proc);
|
||||
if (proc_kill (proc, reschedule_cpu) == PROC_NEED_RESCHEDULE)
|
||||
*reschedule = true;
|
||||
|
||||
return SYSRESULT (ST_OK);
|
||||
}
|
||||
|
||||
@@ -92,7 +95,8 @@ DEFINE_SYSCALL (sys_clone) {
|
||||
|
||||
int pid = new->pid;
|
||||
|
||||
proc_register (new, NULL);
|
||||
if (proc_register (new, reschedule_cpu) == PROC_NEED_RESCHEDULE)
|
||||
*reschedule = true;
|
||||
|
||||
return SYSRESULT (pid);
|
||||
}
|
||||
@@ -102,7 +106,7 @@ DEFINE_SYSCALL (sys_argument_ptr) { return proc->uvaddr_argument; }
|
||||
|
||||
/* int sched (void) */
|
||||
DEFINE_SYSCALL (sys_sched) {
|
||||
proc_sched ();
|
||||
*reschedule = true;
|
||||
return SYSRESULT (ST_OK);
|
||||
}
|
||||
|
||||
@@ -127,8 +131,8 @@ DEFINE_SYSCALL (sys_mutex_delete) {
|
||||
if (mutex_resource == NULL)
|
||||
return SYSRESULT (-ST_NOT_FOUND);
|
||||
|
||||
if (proc_delete_resource (mutex_resource) == PROC_NEED_RESCHEDULE)
|
||||
proc_sched ();
|
||||
if (proc_delete_resource (mutex_resource, reschedule_cpu) == PROC_NEED_RESCHEDULE)
|
||||
*reschedule = true;
|
||||
|
||||
return SYSRESULT (ST_OK);
|
||||
}
|
||||
@@ -142,8 +146,8 @@ DEFINE_SYSCALL (sys_mutex_lock) {
|
||||
if (mutex_resource == NULL)
|
||||
return SYSRESULT (-ST_NOT_FOUND);
|
||||
|
||||
if (proc_mutex_lock (proc, &mutex_resource->u.mutex) == PROC_NEED_RESCHEDULE)
|
||||
proc_sched ();
|
||||
if (proc_mutex_lock (proc, &mutex_resource->u.mutex, reschedule_cpu) == PROC_NEED_RESCHEDULE)
|
||||
*reschedule = true;
|
||||
|
||||
return SYSRESULT (ST_OK);
|
||||
}
|
||||
@@ -157,8 +161,8 @@ DEFINE_SYSCALL (sys_mutex_unlock) {
|
||||
if (mutex_resource == NULL)
|
||||
return SYSRESULT (-ST_NOT_FOUND);
|
||||
|
||||
if (proc_mutex_unlock (proc, &mutex_resource->u.mutex) == PROC_NEED_RESCHEDULE)
|
||||
proc_sched ();
|
||||
if (proc_mutex_unlock (proc, &mutex_resource->u.mutex, reschedule_cpu) == PROC_NEED_RESCHEDULE)
|
||||
*reschedule = true;
|
||||
|
||||
return SYSRESULT (ST_OK);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user