On 02/01/2012 01:08 PM, Dmitry Antipov wrote:
On 02/01/2012 03:49 PM, Daniel Lezcano wrote:

IMO, you have a race condition with nrunning. What guarantee do you
have atomic_dec_and_test is called after atomic_inc ?

Nothing (but I believe ~1s is pretty enough for the kernel thread to get
woken up). I also tried to to atomic_inc() at the beginning of test(),
like:

...
static int test(void *unused)
{
int i;
ktime_t expires = ktime_set(0, NSEC_PER_MSEC);

atomic_inc(&nrunning);

for (i = 0; !kthread_should_stop() && i < loopcount; i++)
schedule_hrtimeout_range(&expires, 50000, HRTIMER_MODE_REL);

if (atomic_dec_and_test(&nrunning))
complete(&done);
return 0;
}
...

Results are the same.

Yes, but the problem is the same also. Did you try by removing atomic_inc and set nrunnings to nrkthread ?



--
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to