From 22dff6b7a6839e77d713d671cb2038e56b64ac16 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Tue, 20 Feb 2018 20:45:13 +0100 Subject: kern/rcu: new module This module implements preemptible RCU. --- kern/thread.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'kern/thread.c') diff --git a/kern/thread.c b/kern/thread.c index 63af1bde..8460f3bc 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -101,6 +101,7 @@ #include #include #include +#include #include #include #include @@ -641,6 +642,8 @@ thread_runq_schedule(struct thread_runq *runq) assert(next->preempt_level == THREAD_SUSPEND_PREEMPT_LEVEL); if (likely(prev != next)) { + rcu_report_context_switch(thread_rcu_reader(prev)); + /* * That's where the true context switch occurs. The next thread must * unlock the run queue and reenable preemption. Note that unlocking @@ -1700,6 +1703,7 @@ thread_init_booter(unsigned int cpu) booter->flags = 0; booter->intr_level = 0; booter->preempt_level = 1; + rcu_reader_init(&booter->rcu_reader); cpumap_fill(&booter->cpumap); thread_set_user_sched_policy(booter, THREAD_SCHED_POLICY_IDLE); thread_set_user_sched_class(booter, THREAD_SCHED_CLASS_IDLE); @@ -1828,6 +1832,7 @@ thread_init(struct thread *thread, void *stack, thread->pin_level = 0; thread->intr_level = 0; thread->llsync_level = 0; + rcu_reader_init(&thread->rcu_reader); cpumap_copy(&thread->cpumap, cpumap); thread_set_user_sched_policy(thread, attr->policy); thread_set_user_sched_class(thread, thread_policy_to_class(attr->policy)); -- cgit v1.2.3