LWN.net Logo

Btrfs aims for the mainline

Btrfs aims for the mainline

Posted Jan 9, 2009 17:57 UTC (Fri) by giraffedata (subscriber, #1954)
In reply to: Btrfs aims for the mainline by pr1268
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.


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds