scalable range locks for scalable address spaces and
play

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


  1. Scalable Range Locks for Scalable Address Spaces And Beyond Alex Kogan Dave Dice Shady Issa Oracle Labs U. Lisboa & INESC-ID

  2. Range Locks • Conceived in parallel filesystems • Allow concurrent access to shared resources • e.g.: writing to the same file 2

  3. Range Locks { EOF { { { BOF 3

  4. Linux kernel Scalability Bottleneck 4

  5. Existing Range Locks [16-21] • Auxiliary red-black tree 0 VMA 1 • Ranges sorted by starting address [5-20] [30-60] VMA 2 VMA 4 • Protected by spin-lock 1 0 • contention even for shared access 5

  6. Existing Range Locks Current RL are not [16-21] • Auxiliary red-black tree scalable 0 VMA 1 • Ranges sorted by starting address [5-20] [30-60] VMA 2 VMA 4 • Protected by spin-lock 1 0 • contention even for shared access 6

  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

  8. List-based Range Locks • A range lock is acquired once a range is inserted into a list • Sorted by their starting addresses 8

  9. List-based Range Locks • A range lock is acquired once a range is inserted into a list • Sorted by their starting addresses R List Head [30-60] CAS CAS [5–20] [16-21] 9

  10. List-based Range Locks • A range lock is acquired once a range is inserted into a list • Sorted by their starting addresses R List Head [16-21] [30-60] [5–20] 10

  11. List-based Range Locks • A range lock is acquired once a range is inserted into a list • Sorted by their starting addresses List Head [1–10] [20-25] [40-43] R [15–45] [30–35] 11

  12. List-based Range Locks • A range lock is acquired once a range is inserted into a list We only need an extra • Sorted by their starting addresses validation step for Read-Write semantics List Head [1–10] [20-25] [40-43] R [15–45] [30–35] 12

  13. VM Management in the Kernel 0xffffffffff Virtual Address Space 0x00000000 13

  14. VM Management in the Kernel 0xffffffffff VMA 1 start: length: Access rights: READ|WRITE VMA 2 start: VMA 3 length: Access rights: start: length: READ|WRITE Access rights: NONE Virtual Address Space 0x00000000 14

  15. VM Management in the Kernel 0xffffffffff VMA 1 VMA 1 mm_rb VMA 1 start: length: VMA 2 VMA 4 Access rights: VMA 3 VMA 2 READ|WRITE VMA 2 start: VMA 3 length: Access rights: start: length: READ|WRITE Access rights: NONE Virtual Address Space 0x00000000 15

  16. VM Management in the Kernel 0xffffffffff mprotect(1000, 100, READ|WRITE) VMA start: 1000 length: 5000 Access rights: READ|WRITE mprotect(3000, 100, NONE) Virtual Address Space 0x00000000 16

  17. VM Management in the Kernel 0xffffffffff mprotect(1000, 100, READ|WRITE) VMA start: 1000 length: 5000 Access rights: READ|WRITE mprotect(3000, 100, NONE) Protecting ranges naively can create Virtual Address data races Space 0x00000000 17

  18. Refined Ranges for VM 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

  19. Refined Ranges for VM 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

  20. Refined Ranges for VM VM_Operation(start, length, args..){ Traverses the Acquire_mm_sem(); red-black tree VMA = find_vma(start); mm_rb // operation logic … read_only operations Decide if structural modification is required … Release_mm_sem(); } 20

  21. Refined Ranges for VM VM_Operation(start, length, args..){ Acquire_mm_sem(); Acquire_RL_Read(start, start+length); Protect with VMA = find_vma(start); range lock of Release_RL(); input range // operation logic … read_only operations Decide if structural modification is required … Release_mm_sem(); } 21

  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 Protect with range … lock of VMA range+ Δ read_only operations Decide if structural modification is required … Release_RL(); Release_mm_sem(); check if the mm_rb changed } meanwhile 22

  23. 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 if structural modification is required{ Acquire full Release_RL(); Acquire_RL_Write(0,2 63 -1); range lock and retry(); retry } … Release_RL(); Release_mm_sem(); } 23

  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

  25. Evaluation Tree-based Range Locks do not scale beyond 32 threads } 9x 25

  26. Evaluation Collected using lock_stats 26

  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

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

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend