[LITMUS^RT] non preemption and unlink()ing

Glenn Elliott gelliott at cs.unc.edu
Fri Jan 17 03:09:42 CET 2014


Hello All,

I’m using nonpreemptive sections pretty heavily in my code, and I’m experiencing a situation where jobs are descheduled, never to return.  I suspect jobs are being unlinked, but never relinked onto a ready queue.

In GSN-EDF, we have the following code:
        if (np && (out_of_time || preempt || sleep)) {
                unlink(entry->scheduled);
                request_exit_np(entry->scheduled);
        }
(link: https://github.com/LITMUS-RT/litmus-rt/blob/master/litmus/sched_gsn_edf.c#L472)

Suppose: np == 1 and preempt == 1, out_of_time == 0, sleep == 0.

Why do we unlink() even if the scheduled task (entry->scheduled) will remain running?  I have tasks that, upon exiting a non-preemptive section, are descheduled and are never rescheduled.  I think they fell off a queue some where.

A log.  Pay special attention to pgmrt/4650.

285694 285694 P21 [__add_ready at litmus/rt_domain.c:307]: rt: adding pgmrt/4650 (12441000, 191976000, 191976000) rel=1519606919297 to ready queue at 1519597109578
...
285697 285696 P10 [is_np at include/litmus/litmus.h:241]: (pgmrt/4650:50)  is non-preemptive: kernel=0 user=1
...
/* vvvv An attempt to preempt is made, but it is rejected.  However, pgmrt/4650 will still be unlinked. vvvv */
285699 285699 P10 [cflsplit_schedule at litmus/sched_cfl_split.c:595]: (pgmrt/4650:50) blocks:0 out_of_time:0 needs_move: 0 np:1 sleep:0 preempt:1 state:0 sig:0 boosted:0
...
285701 285701 P10 [cflsplit_schedule at litmus/sched_cfl_split.c:599]: (pgmrt/4650:50) will be preempted by pgmrt/4723
...
285703 285703 P10 [request_exit_np at include/litmus/litmus.h:154]: (pgmrt/4650:50) setting delayed_preemption flag
...
285705 285705 P10 [is_np at include/litmus/litmus.h:241]: (pgmrt/4650:50)  is non-preemptive: kernel=0 user=1
...
/* vvvv sched_yield() is called in the user space and pgmrt/4650 finally gives up the CPU to pgmrt/4723 vvvv */
285715 285715 P10 [cflsplit_schedule at litmus/sched_cfl_split.c:595]: (pgmrt/4650:50) blocks:0 out_of_time:0 needs_move: 0 np:0 sleep:0 preempt:1 state:0 sig:0 boosted:0
285716 285716 P10 [cflsplit_schedule at litmus/sched_cfl_split.c:599]: (pgmrt/4650:50) will be preempted by pgmrt/4723
285717 285717 P10 [cflsplit_schedule at litmus/sched_cfl_split.c:708]: (pgmrt/4650:50) scheduled_on = NO_CPU
/* ^^^^ pgmrt/4650 is never heard from again ^^^^ */

Do we need to call job_arrival() on the job exiting the non-preemption section?

Thanks,
Glenn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.litmus-rt.org/pipermail/litmus-dev/attachments/20140116/a60993b2/attachment.html>


More information about the litmus-dev mailing list