mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 06:39:01 +08:00
sched/sched:merge tickless and tick process together
Merge tickless and tick process into nxsched_process_timer
to improve code level efficient
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
This commit is contained in:
committed by
Xiang Xiao
parent
a22e26924d
commit
9f44bff3cc
@@ -119,7 +119,7 @@ static void oneshot_callback(FAR struct oneshot_lowerhalf_s *lower,
|
||||
FAR void *arg)
|
||||
{
|
||||
#ifdef CONFIG_SCHED_TICKLESS
|
||||
nxsched_timer_expiration();
|
||||
nxsched_process_timer();
|
||||
#else
|
||||
clock_t now;
|
||||
|
||||
|
||||
@@ -2461,33 +2461,7 @@ void up_ndelay(unsigned long nanoseconds);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_SCHED_TICKLESS
|
||||
void nxsched_process_timer(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxsched_timer_expiration
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_SCHED_TICKLESS is defined, then this function is provided by
|
||||
* the RTOS base code and called from platform-specific code when the
|
||||
* interval timer used to implement the tick-less OS expires.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
* Base code implementation assumes that this function is called from
|
||||
* interrupt handling logic with interrupts disabled.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SCHED_TICKLESS)
|
||||
void nxsched_timer_expiration(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxsched_get_next_expired
|
||||
|
||||
@@ -48,7 +48,8 @@ set(SRCS
|
||||
sched_sysinfo.c
|
||||
sched_get_stateinfo.c
|
||||
sched_switchcontext.c
|
||||
sched_sleep.c)
|
||||
sched_sleep.c
|
||||
sched_processtimer.c)
|
||||
|
||||
if(DEFINED CONFIG_STACKCHECK_MARGIN)
|
||||
if(NOT CONFIG_STACKCHECK_MARGIN EQUAL -1)
|
||||
@@ -98,8 +99,6 @@ endif()
|
||||
|
||||
if(CONFIG_SCHED_TICKLESS)
|
||||
list(APPEND SRCS sched_timerexpiration.c)
|
||||
else()
|
||||
list(APPEND SRCS sched_processtimer.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_SCHED_CRITMONITOR)
|
||||
|
||||
@@ -30,7 +30,7 @@ CSRCS += sched_yield.c sched_rrgetinterval.c sched_foreach.c
|
||||
CSRCS += sched_lock.c sched_unlock.c sched_lockcount.c
|
||||
CSRCS += sched_idletask.c sched_self.c sched_get_stackinfo.c sched_get_tls.c
|
||||
CSRCS += sched_sysinfo.c sched_get_stateinfo.c sched_getcpu.c
|
||||
CSRCS += sched_switchcontext.c sched_sleep.c
|
||||
CSRCS += sched_switchcontext.c sched_sleep.c sched_processtimer.c
|
||||
|
||||
ifneq ($(CONFIG_STACKCHECK_MARGIN),)
|
||||
ifneq ($(CONFIG_STACKCHECK_MARGIN),-1)
|
||||
@@ -80,8 +80,6 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_SCHED_TICKLESS),y)
|
||||
CSRCS += sched_timerexpiration.c
|
||||
else
|
||||
CSRCS += sched_processtimer.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SCHED_CRITMONITOR),y)
|
||||
|
||||
@@ -307,6 +307,30 @@ extern volatile spinlock_t g_cpu_tasklistlock;
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxsched_timer_expiration
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_SCHED_TICKLESS is defined, then this function is provided by
|
||||
* the RTOS base code and called from platform-specific code when the
|
||||
* interval timer used to implement the tick-less OS expires.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
* Base code implementation assumes that this function is called from
|
||||
* interrupt handling logic with interrupts disabled.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SCHED_TICKLESS)
|
||||
void nxsched_timer_expiration(void);
|
||||
#endif
|
||||
|
||||
int nxthread_create(FAR const char *name, uint8_t ttype, int priority,
|
||||
FAR void *stack_addr, int stack_size, main_t entry,
|
||||
FAR char * const argv[], FAR char * const envp[]);
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_SCHED_TICKLESS
|
||||
/****************************************************************************
|
||||
* Name: nxsched_cpu_scheduler
|
||||
*
|
||||
@@ -145,19 +146,7 @@ static inline void nxsched_process_scheduler(void)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* System Timer Hooks
|
||||
*
|
||||
* These are standard interfaces that are exported by the OS
|
||||
* for use by the architecture specific logic
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxsched_process_timer
|
||||
* Name: nxsched_process_tick
|
||||
*
|
||||
* Description:
|
||||
* This function handles system timer events.
|
||||
@@ -174,7 +163,7 @@ static inline void nxsched_process_scheduler(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void nxsched_process_timer(void)
|
||||
static void nxsched_process_tick(void)
|
||||
{
|
||||
#ifdef CONFIG_CLOCK_TIMEKEEPING
|
||||
/* Process wall time */
|
||||
@@ -204,3 +193,27 @@ void nxsched_process_timer(void)
|
||||
board_timerhook();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* System Timer Hooks
|
||||
*
|
||||
* These are standard interfaces that are exported by the OS
|
||||
* for use by the architecture specific logic
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void nxsched_process_timer(void)
|
||||
{
|
||||
#ifdef CONFIG_SCHED_TICKLESS
|
||||
/* Tickless scheduling */
|
||||
|
||||
nxsched_timer_expiration();
|
||||
|
||||
#else
|
||||
/* Periodic tick-based scheduling */
|
||||
|
||||
nxsched_process_tick();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user