[lkml]   [2006]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectIs stopmachine() preempt safe?
I cannot convince myself that stopmachine() is preempt safe.  What
prevents this race with CONFIG_PREEMPT=y?

cpu 0 cpu 1
Process <n> reads a global resource
kernel_thread(stopmachine, 1)
Process <n> is preempted
stopmachine() runs on cpu 1
do_stop() calls smdata->fn
smdata->fn changes global data
stopmachine() exits
Scheduler resumes process <n>
The global resource is out of sync

The stopmachine() threads on the other cpus are set to MAX_RT_PRIO-1 so
they will preempt any existing process. The yield() in stopmachine()
only guarantees that these kernel threads get onto the other cpus, it
does not guarantee that all running tasks will proceed to a yield
themselves before stopmachine runs. IOW, what guarantees that the
scheduler will only run stopmachine() on the target cpus when those
cpus are completely idle with no locally cached global resources?

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-08-27 11:45    [W:0.039 / U:0.072 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site