This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 50e2269642 sched: Stop the sched timer when possible to save the power 
in tickless mode
50e2269642 is described below

commit 50e2269642a0d4487d2399f066a8cce3b872b3fb
Author: Xiang Xiao <[email protected]>
AuthorDate: Tue Jul 26 00:07:12 2022 +0800

    sched: Stop the sched timer when possible to save the power in tickless mode
    
    Remove KEEP_ALIVE_HACK to avoid waking up the device periodly.
    The workaround it's added by:
        commit 6546fa39c7a292e919d1ea396d67bea8242f2c4b
        Author: Gregory Nutt <[email protected]>
        Date:   Tue Aug 12 11:12:00 2014 -0600
    
        Tickless Stuff:  Back out the risky timer operations when the 
ready-to-run
        list is modified. That is unsafe.  An ugly workaround is just to keep an
        interval timer going all of the time with a minimum duration equal to 
the
        timeslice interval.
    But look like it doesn't needed anymore.
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 sched/sched/sched_timerexpiration.c | 34 ----------------------------------
 1 file changed, 34 deletions(-)

diff --git a/sched/sched/sched_timerexpiration.c 
b/sched/sched/sched_timerexpiration.c
index 5fb6d7743c..678e6b8218 100644
--- a/sched/sched/sched_timerexpiration.c
+++ b/sched/sched/sched_timerexpiration.c
@@ -45,31 +45,6 @@
 
 #ifdef CONFIG_SCHED_TICKLESS
 
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* In the original design, it was planned that nxsched_reassess_timer() be
- * called whenever there was a change at the head of the ready-to-run
- * list.  That call was intended to establish a new time-slice or to
- * stop an old time-slice timer.  However, it turns out that that
- * solution is too fragile:  The system is too vulnerable at the time
- * that the ready-to-run list is modified in order to muck with timers.
- *
- * The kludge/work-around is simple to keep the timer running all of the
- * time with an interval of no more than the timeslice interval.  If we
- * do this, then there is really no need to do anything when on context
- * switches.
- */
-
-#define KEEP_ALIVE_HACK 1
-
-#if CONFIG_RR_INTERVAL > 0
-#  define KEEP_ALIVE_TICKS MSEC2TICK(CONFIG_RR_INTERVAL)
-#else
-#  define KEEP_ALIVE_TICKS MSEC2TICK(80)
-#endif
-
 /****************************************************************************
  * Public Data
  ****************************************************************************/
@@ -272,15 +247,6 @@ static uint32_t nxsched_cpu_scheduler(int cpu, uint32_t 
ticks,
 
   /* Returning zero means that there is no interesting event to be timed */
 
-#ifdef KEEP_ALIVE_HACK
-  if (ret == 0)
-    {
-      /* Apply the keep alive hack */
-
-      return KEEP_ALIVE_TICKS;
-    }
-#endif
-
   return ret;
 }
 #endif

Reply via email to