SlidePub
Home
Categories
Login
Register
Home
General
The Maple Tree - Linux Plumbers Conference 2019
The Maple Tree - Linux Plumbers Conference 2019
paolodedios
30 views
21 slides
Oct 18, 2024
Slide
1
of 21
Previous
Next
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
About This Presentation
In-memory, RCU-safe, Range-based B-tree
Size:
27.81 MB
Language:
en
Added:
Oct 18, 2024
Slides:
21 pages
Slide Content
Slide 1
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |Maple Trees are generally deciduous
The Maple Tree
Liam R. Howlett
Linux Plumbers Conference
September 9
th
, 2019
Not Just For Delicious Pancakes
1
Slide 2
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Talk Agenda
Why Another Tree?
Maple Tree
The VMA Search Problem
Node Types and Project Performance
Future Growth
1
2
3
4
5
2The maple is a common symbol of strength and endurance
Slide 3
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Why Another Tree?
•Radix tree (trie)
–When compact, Radix searches are quite efficient
–When sparse, Radix searches are extremely poor
•Rbtree
–Function pointers are not as fast as they were a few years ago
–Not cache optimized
–Not RCU safe
–API is difficult to use
Making a more efficient tree
3Maples in Canada range from over 40M to less than 10M
Slide 4
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Why Another Tree?
•In-memory, RCU-safe, Range-based B-tree
–Optimised for contiguous ranges
–Does not support overlapping ranges (yet)
–Goal to be faster than rbtrees and the Radix tree (trie)
•Multiple node formats
–Range
–Allocating Range (tracks gaps)
–Dense
–Other node types in future (compressed pivots, large leaf nodes, ...)
Maple: Trees for the modern CPU
4Maples are a popular choice for the art of bonsai
Slide 5
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Maple Tree
Looking at a diverse forest
5Dried maple wood is often used for smoking foods
35-44
18-24 55-64
0-1725-3445-5465+
| 44 |∞
17 | 24 | 34 | 44 54 | 64 | ∞
rbtree Maple tree
Slide 6
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Maple Tree
Looking at a sub-optimal, yet still diverse forest
6Maples can be used to produce print quality paper
35-44
18-24
55-64
0-17
25-34
45-54
65+
24 | 44 |∞
17 | 24 | 54 | 64 | ∞
rbtree Maple tree
34 | 44
Slide 7
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Maple Tree
A full sized node maple tree
7Maple charcoal is used to produce Tennessee whiskey
5 | 6| C | 13 | 63 | 78 |(82)F1 | F3 | FF | 10D | 11B | 121 | 12B | (154)
82 | DE |154 |∞
93 | 95 | 9B | A3 | B1 | D1 | D9 | (DE)
Slide 8
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Maple Tree
Different aspects matter for different reasons
8One species of maple extends to the southern hemisphere
rbtree Radix Tree Maple Tree
RCU Safe No Yes Yes
Range supportYes Limited Non-overlapping
Tree height Tall Short* Medium
API Hard Easy Easy
Node Embedded External External
Node size 24 bytes 576 bytes 128 bytes
* with dense indices
Slide 9
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
The VMA search problem
•A task’s address space is a set of non-overlapping Virtual Memory Areas
•Currently stored in an augmented rbtree
–rbtrees are not RCU safe
●
Requires mmap_sem locking to walk the tree
●
This scalability problem will be further discussed by Laurent Dufour
Virtual Memory Areas
9Maple wood is a tonewood – wood that carries sound waves
Slide 10
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Node Types
•range64
–8 entries (unsigned long), 8 byte indices
•arange64 – allocation range 64, tracks largest gap below
–5 entries & 5 gaps (unsigned long), 4 byte indices
•Dense
–15 entries
Node Types: Now With Gaps!
10Sugar maple and Sycamore maples are a source of timber
Slide 11
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Node Types
Seeing the Nodes for the Trees
11
Range64 node
Slot 2Slot 1Slot 0 Slot 3 Slot 4 Slot 7Slot 5 Slot 6
Pivot 0 Pivot 1 Pivot 2 Pivot 3 Pivot 4 Pivot 5 Pivot 6 MaxMin
Allocation Range64 node
Slot 2Slot 1Slot 0 Slot 3 Slot 4
Pivot 0 Pivot 1 Pivot 2 Pivot 3 MaxMin
Gap 0 Gap 1 Gap 2 Gap 3 Gap 4
Parent
Parent
Sugar maple wood is often know as hard maple wood
Slide 12
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Node Types
•128 byte aligned allocations
–7 bits for metadata
•Struct maple_enode: Encoded nodes (mapley node)
–Metadata: Internal node, Full, Node type
•Struct maple_pnode: Parent Node
–Metadata: Parent node type, Slot number in parent
What makes maple so mapley? Just how dense are they?
12Some maple wood has highly decorative wood grain
Slide 13
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Projected Performance
•Perfectly balanced rbtree
–9.56 dereferences on average to find desired VMA
•Maple tree (~20% more NULLs, 1698 entries total)
–Most fragmented tree has 4 entries per leaf node and 3 entries per non-leaf node:
•8 dereferences
–Average tree has 6 entries per leaf node and 4 per non-leaf node:
•7 dereferences
–Most compact tree has 8 entries per leaf node and 5 per non-leaf node:
•7 dereferences
Dereference count; large process test (Firefox has 1415 VMAs)
13Maple Trees are important to the survival of honeybees
Slide 14
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Projected Performance
•rbtree Implementation
–48 bytes per node; about 66KiB
•Maple tree (~20% more NULLs, 1698 entries total)
–Most fragmented tree has 4 entries per leaf node and 3 entries per non-leaf node:
•633 nodes; about 79KiB
–Average tree has 6 entries per leaf node and 4 per non-leaf node:
•378 nodes; about 47KiB
–Most compact tree has 8 entries per leaf node and 5 per non-leaf node:
•268 nodes; about 34KiB
Memory usage; large process test (Firefox has 1415 VMAs)
14It takes 40 Liters of Maple Sap to make 1 Liter of Maple Syrup
Slide 15
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Current development status
•Handling page faults – mas_load()
•mmap(MAP_FIXED) – mt_store()
–Also mremap(MREMAP_FIXED)
•Create VMA at lowest possible free location – mt_alloc_range()
•Create VMA at highest possible free location – mt_alloc_rrange()
•Find next/prev VMA – mas_next()/mas_prev()
•Iterate over all VMAs – mas_for_each()
•Grow VMA (eg stack, mremap()) - mas_store()
Functions to implement VMA operations
15Maples are the primary contributor to the foliage season
Slide 16
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Solving the PID allocation problem
•Radix trees (like the IDR) are good for densely packed IDs
•Once PIDs are freed, radix tree data structure becomes inefficient
•Maple tree will be able to convert between dense nodes and sparse nodes
–Dense nodes contain 15 pointers
–Sparse nodes contain up to 7 pointers and 7 values. All other values in the range
covered by this node are implicitly NULL
Also useful for cgroup ID allocation and many other idr_alloc_cyclic users
16Douglas maple samaras (fruits) are paired in a V-shape
Slide 17
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Large, dense nodes
•Allocate an entire page
–512 * 8 bytes in a page
•Store the parent pointer in the struct page
•Takes three levels out of the tree for dense regions
17The closest relatives of the maples are the horse chestnuts
Useful for the file descriptor table
Slide 18
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Replacing hash tables
•Sparse nodes may let us outperform hash tables
–More benchmarking!
•Hash tables are often mis-sized
–Walking long hash chains is expensive
–Large top-level arrays waste memory
18Maple flowers are green, yellow, orange, and red
Slide 19
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Short Term Plans
●
Finish VMA tree conversion
●
Benchmark & more testing
●
Support 32-bit CPUs
●
Add support for search marks
●
Dust off dense node implementation
●
Use XArray API for Maple Tree
●
Implement sparse64 nodes
Budding interests
19Fall colours are produced by pigments called anthocyanins
Slide 20
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Open questions
•How do we remove old shadow entries from the page cache?
•What should the batch API look like?
•Do the benefits of a larger node size outweigh the disadvantages?
•Can we replace rbtrees with overlapping ranges?
•Is it worth adding a new node type for ranges with gaps between them?
•How many search marks is it useful to support?
20Bigleaf maple trees are able to grow 40m tall or more.
Slide 21
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Tags
Categories
General
Download
Download Slideshow
Get the original presentation file
Quick Actions
Embed
Share
Save
Print
Full
Report
Statistics
Views
30
Slides
21
Age
412 days
Related Slideshows
22
Pray For The Peace Of Jerusalem and You Will Prosper
RodolfoMoralesMarcuc
32 views
26
Don_t_Waste_Your_Life_God.....powerpoint
chalobrido8
35 views
31
VILLASUR_FACTORS_TO_CONSIDER_IN_PLATING_SALAD_10-13.pdf
JaiJai148317
32 views
14
Fertility awareness methods for women in the society
Isaiah47
30 views
35
Chapter 5 Arithmetic Functions Computer Organisation and Architecture
RitikSharma297999
29 views
5
syakira bhasa inggris (1) (1).pptx.......
ourcommunity56
30 views
View More in This Category
Embed Slideshow
Dimensions
Width (px)
Height (px)
Start Page
Which slide to start from (1-21)
Options
Auto-play slides
Show controls
Embed Code
Copy Code
Share Slideshow
Share on Social Media
Share on Facebook
Share on Twitter
Share on LinkedIn
Share via Email
Or copy link
Copy
Report Content
Reason for reporting
*
Select a reason...
Inappropriate content
Copyright violation
Spam or misleading
Offensive or hateful
Privacy violation
Other
Slide number
Leave blank if it applies to the entire slideshow
Additional details
*
Help us understand the problem better