Re: sched: tweak select_idle_sibling to look for idle threads

From: Peter Zijlstra
Date: Fri May 06 2016 - 03:13:04 EST


On Thu, May 05, 2016 at 09:58:44AM -0400, Chris Mason wrote:
> > I'll try and have a prod at the program itself if you have no pending
> > changes on your end.
>
> Sorry, I don't. Look at sleep_for_runtime() and how I test/set the
> global stopping variable in different places. I've almost certainly got
> someone waiting on a wakeup that'll never come.

The below makes it go..

---
schbench.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/schbench.c b/schbench.c
index a0e9f7e..f299959 100644
--- a/schbench.c
+++ b/schbench.c
@@ -49,7 +49,7 @@ static int pipe_test = 0;
static unsigned int max_us = 50000;

/* the message threads flip this to true when they decide runtime is up */
-static unsigned long stopping = 0;
+static volatile unsigned long stopping = 0;


/*
@@ -746,8 +746,8 @@ static void sleep_for_runtime()
else
break;
}
- stopping = 1;
__sync_synchronize();
+ stopping = 1;
}

int main(int ac, char **av)