optee_os/core/arch/arm/kernel/RT_TEE_Scheduler.c
/*
 * update deadline and budget when now >= cur_deadline
 * it need to be updated to the deadline of the current period
 */
update deadline and budget when now >= cur_deadline
it need to be updated to the deadline of the current period
update deadline and budget when now > = cur_deadline it need to be updated to the deadline of the current period
static void rt_update_deadline_and_replenish_budget(struct rt_world *world, s_time_t now)
{
	if(world->cur_deadline <= now){
		if ( world->cur_deadline + (world->period << UPDATE_LIMIT_SHIFT) > now )
	    {
	        do
	            world->cur_deadline += world->period;
	        while ( world->cur_deadline <= now );
	    }
	    else
	    {
	        long count = ((now - world->cur_deadline) / world->period) + 1;
	        world->cur_deadline += count * world->period;
	    }
	}
    if(now - world->last_rpl_time >= world->period){
    	world->cur_budget = world->budget;
    	world->last_rpl_time = now - (now - world->last_rpl_time) % world->period;
    	world->runq_status = RUNQ_RUNNABLE;
    	world->has_nothing_to_run = false;
    }
    return;
}
static void rt_update_deadline_and_replenish_budget ( struct rt_world * world , s_time_t now ) { if ( world -> cur_deadline <= now ) { if ( world -> cur_deadline + ( world -> period << UPDATE_LIMIT_SHIFT ) > now ) { do world -> cur_deadline += world -> period ; while ( world -> cur_deadline <= now ) ; } else { long count = ( ( now - world -> cur_deadline ) / world -> period ) + 1 ; world -> cur_deadline += count * world -> period ; } } if ( now - world -> last_rpl_time >= world -> period ) { world -> cur_budget = world -> budget ; world -> last_rpl_time = now - ( now - world -> last_rpl_time ) % world -> period ; world -> runq_status = RUNQ_RUNNABLE ; world -> has_nothing_to_run = false ; } return ; }
update deadline and budget when now >= cur_deadline
 it need to be updated to the deadline of the current period
update deadline and budget when now > = cur_deadline it need to be updated to the deadline of the current period
//now may be slightly larger than ideal plt_time