summaryrefslogtreecommitdiffstats
path: root/src/include/kernel
diff options
context:
space:
mode:
authorDoug Gilbert <dgilbert@us.ibm.com>2012-07-12 12:17:29 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-07-28 13:04:29 -0500
commitac9ad22f261cd391c0d5163e82ff02ae4929f820 (patch)
tree5e6ab5b19095fdb5de9ce7d69517e9de9a27aa49 /src/include/kernel
parentf6b5db9e2298aa22b148f5a72d64a5564040c61a (diff)
downloadtalos-hostboot-ac9ad22f261cd391c0d5163e82ff02ae4929f820.tar.gz
talos-hostboot-ac9ad22f261cd391c0d5163e82ff02ae4929f820.zip
Reduce timeslice for idle task based on wake time of sleeping tasks
RTC: 43738 Change-Id: I91c2bfe57bba04a02dd5169542de8e76e1654ae8 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1387 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/kernel')
-rw-r--r--src/include/kernel/timemgr.H85
1 files changed, 55 insertions, 30 deletions
diff --git a/src/include/kernel/timemgr.H b/src/include/kernel/timemgr.H
index 96950b928..3f6d658d7 100644
--- a/src/include/kernel/timemgr.H
+++ b/src/include/kernel/timemgr.H
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/kernel/timemgr.H $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2010 - 2011
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/include/kernel/timemgr.H $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2010-2012
+ *
+ * p1
+ *
+ * Object Code Only (OCO) source materials
+ * Licensed Internal Code Source Materials
+ * IBM HostBoot Licensed Internal Code
+ *
+ * The source code for this program is not published or other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
#ifndef __KERNEL_TIMEMGR_H
#define __KERNEL_TIMEMGR_H
@@ -48,13 +49,22 @@ class TimeManager
{
public:
enum
- {
- /** Number of time-slices to allow per second.
- *
- * Context length becomes (1/TIMESLICE_PER_SECOND) sec.
- */
- TIMESLICE_PER_SEC = 1000,
- };
+ {
+ /** Number of time-slices to allow per second.
+ *
+ * Context length becomes (1/TIMESLICE_PER_SECOND) sec.
+ */
+ TIMESLICE_PER_SEC = 1000,
+
+ /** Yield Threshold per timeslice
+ *
+ * @note At 512MHZ clock and TIMESLICE_PER_SEC = 1000,
+ * Timeslice = 512000 ticks.
+ * If threshold/slice = 100 then threhold = 5120 ticks
+ * FYI, a Context switch ~ 476 ticks
+ */
+ YIELD_THRESHOLD_PER_SLICE = 100, // 1%
+ };
/** Initialize the time subsystem. */
static void init();
@@ -68,6 +78,21 @@ class TimeManager
return iv_timebaseFreq / TIMESLICE_PER_SEC;
};
+ /**
+ * Return the number of ticks for an idle time-slice
+ */
+ static uint64_t getIdleTimeSliceCount();
+
+ /**
+ * Perform a simple delay if the time is below the yield threshold.
+ *
+ * @param[in] sec, Delay time in seconds
+ * @param[in] nsec, Delay time in nano seconds
+ * @return false if the delay requires a task yield | true - The
+ * requested delay was performed by this routine.
+ */
+ static bool simpleDelay(uint64_t sec, uint64_t nsec);
+
/** Returns the value of the processor timebase register. */
static uint64_t getCurrentTimeBase()
{
@@ -117,7 +142,7 @@ class TimeManager
void _init_cpu(cpu_t* cpu);
void _delayTask(task_t* t, uint64_t i_sec, uint64_t i_nsec);
void _checkReleaseTasks(Scheduler* s);
- inline delaylist_t* _get_delaylist();
+ static delaylist_t* _get_delaylist();
/** Frequency of the timebase register in Hz. (ticks per second) */
static uint64_t iv_timebaseFreq;
OpenPOWER on IntegriCloud