From fb95c290fe461de794c984bc4130741f04f9142d Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Wed, 3 Feb 2010 19:40:01 -0500 Subject: Re-implement non-preemptive section support. Re-introduce NP sections in the configuration and in litmus.h. Remove the old np_flag from rt_param. If CONFIG_NP_SECTION is disabled, then all non-preemptive section checks are constant expressions which should get removed by the dead code elimination during optimization. Instead of re-implementing sys_exit_np(), we simply repurposed sched_yield() for calling into the scheduler to trigger delayed preemptions. --- litmus/Kconfig | 13 ++++++++++++- litmus/sched_litmus.c | 8 +++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'litmus') diff --git a/litmus/Kconfig b/litmus/Kconfig index 5556ae5cba45..874794f64af1 100644 --- a/litmus/Kconfig +++ b/litmus/Kconfig @@ -2,6 +2,17 @@ menu "LITMUS^RT" menu "Real-Time Synchronization" +config NP_SECTION + bool "Non-preemptive section support" + default n + help + Allow tasks to become non-preemptable. + Note that plugins still need to explicitly support non-preemptivity. + Currently, only GSN-EDF and PSN-EDF have such support. + + This is required to support the FMLP. + If disabled, all tasks will be considered preemptable at all times. + config SRP bool "Stack Resource Policy (SRP)" default n @@ -13,7 +24,7 @@ config SRP config FMLP bool "FMLP support" -# depends on NP_SECTION + depends on NP_SECTION default n help Include support for deterministic multiprocessor real-time diff --git a/litmus/sched_litmus.c b/litmus/sched_litmus.c index 64ad5db07795..c1fc7748e590 100644 --- a/litmus/sched_litmus.c +++ b/litmus/sched_litmus.c @@ -177,7 +177,13 @@ static void dequeue_task_litmus(struct rq *rq, struct task_struct *p, int sleep) static void yield_task_litmus(struct rq *rq) { BUG_ON(rq->curr != current); - litmus->complete_job(); + /* sched_yield() is called to trigger delayed preemptions. + * Thus, mark the current task as needing to be rescheduled. + * This will cause the scheduler plugin to be invoked, which can + * then determine if a preemption is still required. + */ + clear_exit_np(current); + set_tsk_need_resched(current); } /* Plugins are responsible for this. -- cgit v1.2.2