Scalable Range Locks for Scalable Address Spaces And Beyond
Alex Kogan Dave Dice Shady Issa
Oracle Labs
- U. Lisboa & INESC-ID
Scalable Range Locks for Scalable Address Spaces And Beyond Alex - - PowerPoint PPT Presentation
Scalable Range Locks for Scalable Address Spaces And Beyond Alex Kogan Dave Dice Shady Issa Oracle Labs U. Lisboa & INESC-ID Range Locks Conceived in parallel filesystems Allow concurrent access to shared resources e.g.:
Alex Kogan Dave Dice Shady Issa
Oracle Labs
2
3
BOF EOF
4
5
VMA 1 VMA 2 VMA 4
[16-21] [5-20] [30-60]
1
6
VMA 1 VMA 2 VMA 4
[16-21] [5-20] [30-60]
1
Current RL are not scalable
7
8
9
R
List Head
[30-60] [5–20] [16-21]
CAS CAS
10
R
List Head
[30-60] [16-21] [5–20]
11
List Head
R
[20-25] [1–10] [40-43] [15–45] [30–35]
12
List Head
R
[20-25] [1–10]
We only need an extra validation step for Read-Write semantics
[40-43] [15–45] [30–35]
13
Virtual Address Space 0x00000000 0xffffffffff
14
Virtual Address Space 0x00000000 0xffffffffff VMA 1 start: length: Access rights: READ|WRITE VMA 2 start: length: Access rights: READ|WRITE VMA 3 start: length: Access rights: NONE
15
Virtual Address Space 0x00000000 0xffffffffff VMA 1 start: length: Access rights: READ|WRITE VMA 2 start: length: Access rights: READ|WRITE VMA 3 start: length: Access rights: NONE VMA 1 VMA 2 VMA 4
VMA 1 VMA 3 VMA 2
mm_rb
16
Virtual Address Space 0x00000000 0xffffffffff VMA start: 1000 length: 5000 Access rights: READ|WRITE
mprotect(1000, 100, READ|WRITE) mprotect(3000, 100, NONE)
17
Virtual Address Space 0x00000000 0xffffffffff VMA start: 1000 length: 5000 Access rights: READ|WRITE
mprotect(1000, 100, READ|WRITE) mprotect(3000, 100, NONE)
Protecting ranges naively can create data races
VM_Operation(start, length, args..){
Acquire_mm_sem(); VMA = find_vma(start); // operation logic … read_only operations Decide if structural modification is required … Release_mm_sem();
}
18
VM_Operation(start, length, args..){
Acquire_mm_sem(); VMA = find_vma(start); // operation logic … read_only operations Decide if structural modification is required … Release_mm_sem();
}
19
VM_Operation(start, length, args..){
Acquire_mm_sem(); VMA = find_vma(start); // operation logic … read_only operations Decide if structural modification is required … Release_mm_sem();
}
20
Traverses the red-black tree mm_rb
VM_Operation(start, length, args..){
Acquire_mm_sem(); Acquire_RL_Read(start, start+length); VMA = find_vma(start); Release_RL(); // operation logic … read_only operations Decide if structural modification is required … Release_mm_sem();
}
21
Protect with range lock of input range
VM_Operation(start, length, args..){
Acquire_mm_sem(); Acquire_RL_Read(start, start+length); VMA = find_vma(start); Release_RL(); Acquire_RL_Write(VMA.start-x, VMA.end+x); // operation logic … read_only operations Decide if structural modification is required … Release_RL(); Release_mm_sem();
}
22
Protect with range lock of VMA range+Δ
check if the mm_rb changed meanwhile
23
Acquire full range lock and retry
VM_Operation(start, length, args..){
Acquire_mm_sem(); Acquire_RL_Read(start, start+length); VMA = find_vma(start); Release_RL(); Acquire_RL_Write(VMA.start-x, VMA.end)+x; // operation logic … read_only operations if structural modification is required{ Release_RL(); Acquire_RL_Write(0,263-1); retry(); } … Release_RL(); Release_mm_sem();
}
24
25
Tree-based Range Locks do not scale beyond 32 threads
26
Collected using lock_stats
27
28