diff options
author | Richard Braun <rbraun@sceen.net> | 2017-09-02 16:06:54 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-09-02 16:06:54 +0200 |
commit | 7ded1b60d46d8582be0d86cd7176048bcfe30ccf (patch) | |
tree | 3b1ed96ad276c6aeff56c58380e59e643559e9c4 /kern/thread.c | |
parent | 1469ce26e2e58082fd4bbb343cad60f2d696a641 (diff) |
kern/thread: new preemption control macros
These new macros take care of disabling/restoring interrupts in the
appropriate order.
Diffstat (limited to 'kern/thread.c')
-rw-r--r-- | kern/thread.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/kern/thread.c b/kern/thread.c index 5d8ac11d..9ee9b99e 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -1277,8 +1277,7 @@ thread_sched_fs_balance_scan(struct thread_runq *runq, remote_runq = NULL; - thread_preempt_disable(); - cpu_intr_save(&flags); + thread_preempt_disable_intr_save(&flags); cpumap_for_each(&thread_active_runqs, i) { tmp = percpu_ptr(thread_runq, i); @@ -1312,8 +1311,7 @@ thread_sched_fs_balance_scan(struct thread_runq *runq, spinlock_unlock(&remote_runq->lock); } - cpu_intr_restore(flags); - thread_preempt_enable(); + thread_preempt_enable_intr_restore(flags); return remote_runq; } @@ -1444,8 +1442,7 @@ thread_sched_fs_balance(struct thread_runq *runq, unsigned long *flags) remote_runq = thread_sched_fs_balance_scan(runq, highest_round); if (remote_runq != NULL) { - thread_preempt_disable(); - cpu_intr_save(flags); + thread_preempt_disable_intr_save(flags); thread_runq_double_lock(runq, remote_runq); nr_migrations = thread_sched_fs_balance_migrate(runq, remote_runq, highest_round); @@ -1472,8 +1469,7 @@ thread_sched_fs_balance(struct thread_runq *runq, unsigned long *flags) continue; } - thread_preempt_disable(); - cpu_intr_save(flags); + thread_preempt_disable_intr_save(flags); thread_runq_double_lock(runq, remote_runq); nr_migrations = thread_sched_fs_balance_migrate(runq, remote_runq, highest_round); @@ -2452,8 +2448,7 @@ thread_wakeup_common(struct thread *thread, int error) thread_unlock_runq(runq, flags); } - thread_preempt_disable(); - cpu_intr_save(&flags); + thread_preempt_disable_intr_save(&flags); if (!thread->pinned) { runq = thread_get_real_sched_ops(thread)->select_runq(thread); @@ -2469,8 +2464,7 @@ thread_wakeup_common(struct thread *thread, int error) thread->wakeup_error = error; thread_runq_wakeup(runq, thread); spinlock_unlock(&runq->lock); - cpu_intr_restore(flags); - thread_preempt_enable(); + thread_preempt_enable_intr_restore(flags); return 0; } |