brintos

brintos / linux-shallow public Read only

0
0
Text · 5.4 KiB · dc4db59 Raw
102 lines · plain
1.. SPDX-License-Identifier: GPL-2.02 3==========4Device DAX5==========6 7The device-dax interface uses the tail deduplication technique explained in8Documentation/mm/vmemmap_dedup.rst9 10On powerpc, vmemmap deduplication is only used with radix MMU translation. Also11with a 64K page size, only the devdax namespace with 1G alignment uses vmemmap12deduplication.13 14With 2M PMD level mapping, we require 32 struct pages and a single 64K vmemmap15page can contain 1024 struct pages (64K/sizeof(struct page)). Hence there is no16vmemmap deduplication possible.17 18With 1G PUD level mapping, we require 16384 struct pages and a single 64K19vmemmap page can contain 1024 struct pages (64K/sizeof(struct page)). Hence we20require 16 64K pages in vmemmap to map the struct page for 1G PUD level mapping.21 22Here's how things look like on device-dax after the sections are populated::23 +-----------+ ---virt_to_page---> +-----------+   mapping to   +-----------+24 |           |                     |     0     | -------------> |     0     |25 |           |                     +-----------+                +-----------+26 |           |                     |     1     | -------------> |     1     |27 |           |                     +-----------+                +-----------+28 |           |                     |     2     | ----------------^ ^ ^ ^ ^ ^29 |           |                     +-----------+                   | | | | |30 |           |                     |     3     | ------------------+ | | | |31 |           |                     +-----------+                     | | | |32 |           |                     |     4     | --------------------+ | | |33 |    PUD    |                     +-----------+                       | | |34 |   level   |                     |     .     | ----------------------+ | |35 |  mapping  |                     +-----------+                         | |36 |           |                     |     .     | ------------------------+ |37 |           |                     +-----------+                           |38 |           |                     |     15    | --------------------------+39 |           |                     +-----------+40 |           |41 |           |42 |           |43 +-----------+44 45 46With 4K page size, 2M PMD level mapping requires 512 struct pages and a single474K vmemmap page contains 64 struct pages(4K/sizeof(struct page)). Hence we48require 8 4K pages in vmemmap to map the struct page for 2M pmd level mapping.49 50Here's how things look like on device-dax after the sections are populated::51 52 +-----------+ ---virt_to_page---> +-----------+   mapping to   +-----------+53 |           |                     |     0     | -------------> |     0     |54 |           |                     +-----------+                +-----------+55 |           |                     |     1     | -------------> |     1     |56 |           |                     +-----------+                +-----------+57 |           |                     |     2     | ----------------^ ^ ^ ^ ^ ^58 |           |                     +-----------+                   | | | | |59 |           |                     |     3     | ------------------+ | | | |60 |           |                     +-----------+                     | | | |61 |           |                     |     4     | --------------------+ | | |62 |    PMD    |                     +-----------+                       | | |63 |   level   |                     |     5     | ----------------------+ | |64 |  mapping  |                     +-----------+                         | |65 |           |                     |     6     | ------------------------+ |66 |           |                     +-----------+                           |67 |           |                     |     7     | --------------------------+68 |           |                     +-----------+69 |           |70 |           |71 |           |72 +-----------+73 74With 1G PUD level mapping, we require 262144 struct pages and a single 4K75vmemmap page can contain 64 struct pages (4K/sizeof(struct page)). Hence we76require 4096 4K pages in vmemmap to map the struct pages for 1G PUD level77mapping.78 79Here's how things look like on device-dax after the sections are populated::80 81 +-----------+ ---virt_to_page---> +-----------+   mapping to   +-----------+82 |           |                     |     0     | -------------> |     0     |83 |           |                     +-----------+                +-----------+84 |           |                     |     1     | -------------> |     1     |85 |           |                     +-----------+                +-----------+86 |           |                     |     2     | ----------------^ ^ ^ ^ ^ ^87 |           |                     +-----------+                   | | | | |88 |           |                     |     3     | ------------------+ | | | |89 |           |                     +-----------+                     | | | |90 |           |                     |     4     | --------------------+ | | |91 |    PUD    |                     +-----------+                       | | |92 |   level   |                     |     .     | ----------------------+ | |93 |  mapping  |                     +-----------+                         | |94 |           |                     |     .     | ------------------------+ |95 |           |                     +-----------+                           |96 |           |                     |   4095    | --------------------------+97 |           |                     +-----------+98 |           |99 |           |100 |           |101 +-----------+102