Sep 9 – 11, 2019
Europe/Lisbon timezone

replacing mmap_sem with finer grained locks

Sep 10, 2019, 10:45 AM
Floriana/room-III (Corinthia Hotel Lisbon)


Corinthia Hotel Lisbon

Kernel Summit talk Kernel Summit Track


Michel Lespinasse (Google)


In the linux kernel, most operations affecting a process's address space are protected by by mmap_sem (a per-process read-write semaphore).

This simple design is increasingly a problem for multi-threaded applications, and often causes threads that operate on separate parts of their address space to end up blocking on each other due to false sharing issues - mmap_sem only supports locking the entire address space at once, so it can't take into consideration that the operations are not overlapping.

I would like to discuss:
1- The sort of blocking issues that are seen today due to the current mmap_sem design;
2- mmap_sem mitigations that have been introduced over time, and have kept the situation bearable but not fundamentally solved the issue;
3- try to discuss from first principles how the MM data structures and locking mechanisms would have to evolve to support finer grained MM locking, and how to progressively migrate the current MM codebase towards such a finer grained MM locking scheme;
4- (hopefully) present early results with a fine grained MM locking prototype.

I agree to abide by the anti-harassment policy Yes

Primary author

Presentation materials