Btrfs aims for the mainline
Posted Jan 9, 2009 17:57 UTC (Fri) by giraffedata
In reply to: Btrfs aims for the mainline
Parent article: Btrfs aims for the mainline
Why not just get rid of the outer (top) if-statement altogether, and move the cpu_relax() statement to after the inner if-statement?
In at least some systems, it is probably an extra instruction or two for the most common case -- that the lock is available immediately. Lock algorithms are usually written this way.
Incidentally, as long as we're counting, it's 514. mutex_lock_nested() will necessarily try to acquire the lock before going to sleep.
to post comments)