Per-cpu kernel pseudo process
This commit is contained in:
@@ -5,19 +5,20 @@
|
||||
#include <proc/reschedule.h>
|
||||
#include <proc/resource.h>
|
||||
#include <proc/suspension_q.h>
|
||||
#include <status.h>
|
||||
#include <sync/spin_lock.h>
|
||||
#include <sys/smp.h>
|
||||
#include <sys/spin_lock.h>
|
||||
|
||||
void proc_sq_suspend (struct proc* proc, struct proc_suspension_q* sq, spin_lock_t* resource_lock,
|
||||
struct reschedule_ctx* rctx) {
|
||||
int proc_sq_suspend (struct proc* proc, struct proc_suspension_q* sq, spin_lock_t* resource_lock,
|
||||
struct reschedule_ctx* rctx) {
|
||||
struct cpu* cpu = proc->cpu;
|
||||
|
||||
struct proc_sq_entry* sq_entry = malloc (sizeof (*sq_entry));
|
||||
if (!sq_entry) {
|
||||
if (resource_lock != NULL)
|
||||
spin_unlock (resource_lock);
|
||||
return;
|
||||
return -ST_OOM_ERROR;
|
||||
}
|
||||
|
||||
sq_entry->proc = proc;
|
||||
@@ -45,16 +46,19 @@ void proc_sq_suspend (struct proc* proc, struct proc_suspension_q* sq, spin_lock
|
||||
cpu->proc_current = NULL;
|
||||
|
||||
proc->cpu = NULL;
|
||||
int state = proc->state;
|
||||
|
||||
spin_unlock (&sq->lock);
|
||||
spin_unlock (&proc->lock);
|
||||
spin_unlock (&cpu->lock);
|
||||
|
||||
rctx_insert_cpu (rctx, cpu);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
void proc_sq_resume (struct proc* proc, struct proc_sq_entry* sq_entry,
|
||||
struct reschedule_ctx* rctx) {
|
||||
int proc_sq_resume (struct proc* proc, struct proc_sq_entry* sq_entry,
|
||||
struct reschedule_ctx* rctx) {
|
||||
struct cpu* cpu = cpu_find_lightest ();
|
||||
struct proc_suspension_q* sq = sq_entry->sq;
|
||||
|
||||
@@ -76,6 +80,8 @@ void proc_sq_resume (struct proc* proc, struct proc_sq_entry* sq_entry,
|
||||
list_append (cpu->proc_run_q, &proc->cpu_run_q_link);
|
||||
cpu->proc_run_q_count++;
|
||||
|
||||
int state = proc->state;
|
||||
|
||||
spin_unlock (&sq->lock);
|
||||
spin_unlock (&proc->lock);
|
||||
spin_unlock (&cpu->lock);
|
||||
@@ -83,6 +89,8 @@ void proc_sq_resume (struct proc* proc, struct proc_sq_entry* sq_entry,
|
||||
free (sq_entry);
|
||||
|
||||
rctx_insert_cpu (rctx, cpu);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
void proc_sqs_cleanup (struct proc* proc) {
|
||||
|
||||
Reference in New Issue
Block a user