diff --git a/TODO b/TODO index 17f0905874..42978a0443 100644 --- a/TODO +++ b/TODO @@ -226,6 +226,16 @@ o Task/Scheduler (sched/) asynchronous event, the budget will fail to decrement and the task will get a larger share of CPU that is deserves in those cases. + + UPDATE: The hook sched_suspend_scheduler() has been added to + all locations where a thread is suspended. This would be + the place to assess any partial intervals: You would have to + save the current time when the timer is started then when + suspended, you would have to assess the elapsed portion of + that time and subtract that from the TCB timeslice value. + + The hook is present, but logic has been implemented. + Status: Open Priority: Low. I am not aware of any real world issues. diff --git a/arch b/arch index d0dcd3c458..3cf52c8fd1 160000 --- a/arch +++ b/arch @@ -1 +1 @@ -Subproject commit d0dcd3c458ded300407756c300bc39bbfdd9489a +Subproject commit 3cf52c8fd170931f7458132589a7ebc8c9f9480c diff --git a/sched/sched/sched_sporadic.c b/sched/sched/sched_sporadic.c index 8247049975..e096222b72 100644 --- a/sched/sched/sched_sporadic.c +++ b/sched/sched/sched_sporadic.c @@ -111,8 +111,8 @@ static int sporadic_budget_start(FAR struct tcb_s *tcb, /* Start the next replenishment interval */ - tcb->timeslice = budget; - tcb->current = budget; + tcb->timeslice = budget; + sporadic->current = budget; ret = wd_start(&repl->timer, budget, sporadic_budget_expire, 1, (wdentry_t)repl); @@ -311,8 +311,8 @@ static int sporadic_interval_start(FAR struct replenishment_s *repl) /* Enter the low-priority phase of the replenishment cycle */ - tcb->timeslice = 0; - tcb->current = 0; + tcb->timeslice = 0; + sporadic->current = 0; /* Calculate the remainder of the replenishment interval. This is * permitted to be zero, in which case we just restart the budget @@ -673,7 +673,7 @@ int sched_sporadic_stop(FAR struct tcb_s *tcb) /* The free the container holder the sporadic scheduling parameters */ - kmm_free(tcb->sporadic); + sched_kfree(tcb->sporadic); tcb->sporadic = NULL; return OK; } @@ -873,6 +873,7 @@ uint32_t sched_sporadic_process(FAR struct tcb_s *tcb, uint32_t ticks, { /* Does the thread have the scheduler locked? */ + sporadic = tcb->sporadic; if (tcb->lockcount > 0) { /* Yes... then we have no option but to give the thread more @@ -912,7 +913,6 @@ uint32_t sched_sporadic_process(FAR struct tcb_s *tcb, uint32_t ticks, * good thing to do, but is certainly permitted. */ - sporadic = tcb->sporadic; if (sporadic->budget >= sporadic->repl_period) { tcb->timeslice = sporadic->budget;