Kernel module/kthread question
dmitry.antipov at linaro.org
Wed Feb 1 12:08:49 UTC 2012
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)
ktime_t expires = ktime_set(0, NSEC_PER_MSEC);
for (i = 0; !kthread_should_stop() && i < loopcount; i++)
schedule_hrtimeout_range(&expires, 50000, HRTIMER_MODE_REL);
Results are the same.
More information about the linaro-dev