[SERVER-29462] Eliminate possibility of false sharing in partitioned lock Created: 06/Jun/17  Updated: 30/Oct/23  Resolved: 05/Jul/17

Status: Closed
Project: Core Server
Component/s: Concurrency, Performance
Affects Version/s: None
Fix Version/s: 3.5.10

Type: Improvement Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Andrew Morrow (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-29712 Polyfill std::hardware_{con,de}struct... Closed
Duplicate
is duplicated by SERVER-29704 Align locks in mongo::Partitioned to ... Closed
Related
related to SERVER-21754 CursorManager Lock is very hot Closed
Backwards Compatibility: Fully Compatible
Sprint: Platforms 2017-07-10
Participants:

 Description   

The vector of mutexes inside catalog/util/partitioned.h does not ensure that the locks are on different cache lines.

Ideally, we would use C++17's std::hardware_destructive_interference_size and alignas to fix this, however, not all of our toolchains currently support the required extended alignment.

Instead, as a simpler fix, we should just allocate the mutexes on the heap, which is very likely to ensure that they land on different cachelines.



 Comments   
Comment by Githook User [ 05/Jul/17 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: SERVER-29462 Align locks in mongo::Paritioned to avoid false sharing

This reverts commit 5a933be9235b7d02bb5c790c7ff7eba3a867c43a.
Branch: master
https://github.com/mongodb/mongo/commit/12568fbc406678ebd98a93d121175b1f765c4766

Comment by Githook User [ 03/Jul/17 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: Revert "SERVER-29462 Align locks in mongo::Paritioned to avoid false sharing"

This reverts commit edc858ca3a32974c07f027e6860a52ac6e89039b.
Branch: master
https://github.com/mongodb/mongo/commit/5a933be9235b7d02bb5c790c7ff7eba3a867c43a

Comment by Githook User [ 01/Jul/17 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: SERVER-29462 Align locks in mongo::Paritioned to avoid false sharing
Branch: master
https://github.com/mongodb/mongo/commit/edc858ca3a32974c07f027e6860a52ac6e89039b

Comment by Andrew Morrow (Inactive) [ 20/Jun/17 ]

kyle.suarez - Yes, and I actually plumbed it through the partitioned lock too, so I'll grab this ticket for now.

Comment by Kyle Suarez [ 19/Jun/17 ]

Looks like acm is actively working on SERVER-29712, so we could do this ticket after that work is in, rather than just allocating the mutexes on the heap.

Generated at Thu Feb 08 04:20:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.