[Skiboot] [PATCH 22/34] time: Use time_wait_nopoll() instead of spinning

Benjamin Herrenschmidt benh at kernel.crashing.org
Sun Jul 24 09:27:16 AEST 2016


In time_wait_poll(), if the remaining time is smaller than our
polling period, we just spin there. Instead, call time_wait_nopoll
which will eventually be able to enter nap mode.

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 core/timebase.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/core/timebase.c b/core/timebase.c
index 0714f25..152bc2f 100644
--- a/core/timebase.c
+++ b/core/timebase.c
@@ -35,12 +35,16 @@ static void time_wait_poll(unsigned long duration)
 
 	while (tb_compare(mftb(), end) != TB_AAFTERB) {
 		/* Call pollers periodically but not continually to avoid
-		 * bouncing cachelines due to lock contention. */
+		 * bouncing cachelines due to lock contention.
+		 *
+		 * This also allows us to nap for a bit
+		 */
 		if (remaining >= period) {
 			opal_run_pollers();
 			time_wait_nopoll(period);
 			remaining -= period;
-		}
+		} else
+			time_wait_nopoll(remaining);
 
 		cpu_relax();
 	}
-- 
2.7.4



More information about the Skiboot mailing list