[LU-4588] replace semaphores with mutexes Created: 05/Feb/14  Updated: 06/Nov/14  Resolved: 28/Mar/14

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.6.0, Lustre 2.5.4

Type: Improvement Priority: Minor
Reporter: Dmitry Eremin (Inactive) Assignee: Dmitry Eremin (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
is related to LU-4257 parallel dds are slower than serial dds Resolved
Rank (Obsolete): 12537

 Description   

According https://www.kernel.org/doc/Documentation/mutex-design.txt:

  • the mutex subsystem is slightly faster and has better scalability
    for contended workloads. In terms of 'ops per CPU cycle', the
    semaphore kernel performed 551 ops/sec per 1% of CPU time used,
    while the mutex kernel performed 3825 ops/sec per 1% of CPU time
    used - it was 6.9 times more efficient.
  • there are no fastpath tradeoffs, the mutex fastpath is just as
    tight as the semaphore fastpath. On x86, the locking fastpath is
    2 instructions.
  • 'struct mutex' semantics are well-defined and are enforced if
    CONFIG_DEBUG_MUTEXES is turned on. Semaphores on the other hand
    have virtually no debugging code or instrumentation.

One more benefit of mutex is optimistic spinning. It try to spin for
acquisition when there are no pending waiters and the lock owner is
currently running on a (different) CPU. The rationale is that if the
lock owner is running, it is likely to release the lock soon.

This significantly reduce amount of context switches when locked
region is small and we have high contention.



 Comments   
Comment by Dmitry Eremin (Inactive) [ 18/Feb/14 ]

Patch is http://review.whamcloud.com/9294

Comment by Dmitry Eremin (Inactive) [ 28/Mar/14 ]

Patch landed to master.

Generated at Sat Feb 10 01:44:05 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.