[dm-devel] dm-table: delayed cleanup for dm_table_destroy()
Mikulas Patocka
mpatocka at redhat.com
Wed Mar 21 01:20:28 UTC 2012
On Tue, 20 Mar 2012, Mike Snitzer wrote:
> I once wanted to replace all msleep(1); with cpu_relax();:
> http://www.redhat.com/archives/dm-devel/2010-September/msg00100.html
>
> But Alasdair wasn't sure if cpu_relax() would provide the required
> delay effect:
> https://www.redhat.com/archives/dm-devel/2011-June/msg00080.html
cpu_relax() would basically kill the kernel if compiled without preempt.
cpu_relax() makes the current processor sleep for a little moment, but it
doesn't schedule a different process.
cpu_relax() is useful in spinlocks - so that process waiting on a spinlock
is not slowing down the other process on a CPU with hyperthreading.
There was another possibility --- replace msleep(1) with yield(). The
problem with yield() is that if the process has readltime priority and
calls yield(), it doesn't give CPU to a different process with a lower
priority. So it would cause deadlock if executed with realtime priority.
msleep(1) doesn't have this problem, so it's the best.
Mikulas
More information about the dm-devel
mailing list