kernel: add support for getting percpu variables that belong to other CPUs
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <socks/sched.h>
|
||||
#include <socks/percpu.h>
|
||||
#include <socks/cpu.h>
|
||||
|
||||
#define PRIO_MASK(p) (((uint32_t)1) << (p))
|
||||
#define FIRST_PRIO(m) (m > 0 ? (PRIO_MAX - __builtin_clz(m) - 1) : -1)
|
||||
@@ -42,6 +43,16 @@ void rq_enqueue(struct runqueue *rq, struct thread *thr)
|
||||
|
||||
struct queue *q = &rq->rq_queues[prio];
|
||||
queue_push_back(q, &thr->tr_rqentry);
|
||||
rq->rq_nthreads++;
|
||||
|
||||
rq->rq_readybits |= PRIO_MASK(thread_priority(thr));
|
||||
}
|
||||
|
||||
struct runqueue *cpu_rq(unsigned int cpu)
|
||||
{
|
||||
struct cpu_data *cpu_data = get_cpu(cpu);
|
||||
struct runqueue *rq = &cpu_data->c_rq;
|
||||
put_cpu(cpu_data);
|
||||
|
||||
return rq;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user