Scalable Range Locks for Scalable Address Spaces And Beyond Alex - - PowerPoint PPT Presentation

scalable range locks for scalable address spaces and
SMART_READER_LITE
LIVE PREVIEW

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.:


slide-1
SLIDE 1

Scalable Range Locks for Scalable Address Spaces And Beyond

Alex Kogan Dave Dice Shady Issa

Oracle Labs

  • U. Lisboa & INESC-ID
slide-2
SLIDE 2
  • Conceived in parallel filesystems
  • Allow concurrent access to shared resources
  • e.g.: writing to the same file

Range Locks

2

slide-3
SLIDE 3

Range Locks

3

BOF EOF

{

{

{

{

slide-4
SLIDE 4

Linux kernel Scalability Bottleneck

4

slide-5
SLIDE 5

Existing Range Locks

  • Auxiliary red-black tree
  • Ranges sorted by starting address
  • Protected by spin-lock
  • contention even for shared access

5

VMA 1 VMA 2 VMA 4

[16-21] [5-20] [30-60]

1

slide-6
SLIDE 6

Existing Range Locks

  • Auxiliary red-black tree
  • Ranges sorted by starting address
  • Protected by spin-lock
  • contention even for shared access

6

VMA 1 VMA 2 VMA 4

[16-21] [5-20] [30-60]

1

Current RL are not scalable

slide-7
SLIDE 7

Our Contributions

  • New design for Range locks
  • Lock-free in the common case
  • Scales up to 144 threads
  • Speculative approach for VM operations in the Linux kernel
  • Range locks for skip lists

7

slide-8
SLIDE 8

List-based Range Locks

  • A range lock is acquired once a range is inserted into a list
  • Sorted by their starting addresses

8

slide-9
SLIDE 9
  • A range lock is acquired once a range is inserted into a list
  • Sorted by their starting addresses

List-based Range Locks

9

R

List Head

[30-60] [5–20] [16-21]

CAS CAS

slide-10
SLIDE 10

List-based Range Locks

10

R

List Head

[30-60] [16-21] [5–20]

  • A range lock is acquired once a range is inserted into a list
  • Sorted by their starting addresses
slide-11
SLIDE 11
  • A range lock is acquired once a range is inserted into a list
  • Sorted by their starting addresses

List-based Range Locks

11

List Head

R

[20-25] [1–10] [40-43] [15–45] [30–35]

slide-12
SLIDE 12
  • A range lock is acquired once a range is inserted into a list
  • Sorted by their starting addresses

List-based Range Locks

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]

slide-13
SLIDE 13

VM Management in the Kernel

13

Virtual Address Space 0x00000000 0xffffffffff

slide-14
SLIDE 14

VM Management in the Kernel

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

slide-15
SLIDE 15

VM Management in the Kernel

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

slide-16
SLIDE 16

VM Management in the Kernel

16

Virtual Address Space 0x00000000 0xffffffffff VMA start: 1000 length: 5000 Access rights: READ|WRITE

mprotect(1000, 100, READ|WRITE) mprotect(3000, 100, NONE)

slide-17
SLIDE 17

VM Management in the Kernel

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

slide-18
SLIDE 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();

}

Refined Ranges for VM

18

slide-19
SLIDE 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();

}

Refined Ranges for VM

19

slide-20
SLIDE 20

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();

}

Refined Ranges for VM

20

Traverses the red-black tree mm_rb

slide-21
SLIDE 21

Refined Ranges for VM

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

slide-22
SLIDE 22

Refined Ranges for VM

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

slide-23
SLIDE 23

Refined Ranges for VM

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();

}

slide-24
SLIDE 24

Evaluation

  • Linux kernel 4.16.0-rc2
  • 4 Intel Xeon E7-8895 v3 (144 threads)
  • Metis benchmark (wrmem)
  • Baselines:
  • Stock
  • Tree-based RL (with and w/out speculation)
  • List-based RL (with and w/out speculation)

24

slide-25
SLIDE 25

Evaluation

25

} 9x

Tree-based Range Locks do not scale beyond 32 threads

slide-26
SLIDE 26

Evaluation

26

Collected using lock_stats

slide-27
SLIDE 27

More in the paper…

  • Evaluation:
  • More workloads
  • User-space applications
  • Range Locks design
  • Fast path, avoiding starvation, memory reclamation
  • Range locks for skip lists

27

slide-28
SLIDE 28

Conclusion

  • Scalable linked list-based Range Locks
  • New speculative approach for the Linux VM
  • Using Range Locks for concurrent data structures

28