OLD | NEW |
(Empty) | |
| 1 |
| 2 # physmem_alloc_analysis: Physical memory allocation analysis |
| 3 |
| 4 This directory contains code to profile physical memory allocation |
| 5 for mmap, and analyze how contiguous the assigned physical frames are. |
| 6 This analysis is useful for evaluating the feasibility of double-sided |
| 7 rowhammering when there is no permission to access `/proc/self/pagemap`. |
| 8 |
| 9 ## How to run the program |
| 10 |
| 11 To compile and run the profiler: |
| 12 |
| 13 ``` |
| 14 ./make.sh |
| 15 ./physmem_alloc_profiler [-a alloc_size] [-s sleep_sec] |
| 16 ``` |
| 17 |
| 18 The profiler mmaps a chunk of memory of `alloc_size` (pages) each time, |
| 19 computes the assigned physical frames using `/proc/pid/pagemap` interface, |
| 20 and munmaps it. It then sleeps `sleep_sec` (seconds) before the next iteration. |
| 21 The program loops infinitely so manual Control-C is needed to stop it. |
| 22 A file named `physmem_alloc_results` is generated to record the assigned |
| 23 physical frame numbers. |
| 24 |
| 25 To analyze the results, run: |
| 26 |
| 27 ``` |
| 28 ./analyze.sh |
| 29 ``` |
| 30 |
| 31 This takes `physmem_alloc_results` as input and produces another file: |
| 32 `contiguous_results`. As output, it shows the content of `contiguous_results` |
| 33 and invokes gnuplot for plotting as well. |
| 34 |
| 35 ## Output format |
| 36 |
| 37 For `physmem_alloc_results`, each line contains information for each mmap |
| 38 allocation. The assigned physical frame numbers of each page are separated |
| 39 by space. |
| 40 |
| 41 For `contiguous_results` (which is also shown as output for analyze.sh), |
| 42 each line is of the following format: |
| 43 |
| 44 ``` |
| 45 size count size_total fraction |
| 46 ``` |
| 47 |
| 48 where: |
| 49 |
| 50 * `size` is the size (in number of pages) of virtual memory area that |
| 51 assigned with contiguous physical frames. |
| 52 |
| 53 * `count` is the number of times such virtual memory area appears. |
| 54 |
| 55 * `size_total` = `size` * `count`, i.e., it is the total size |
| 56 (in number of pages) for such memory area. |
| 57 |
| 58 * `fraction` = `size_total` / `alloc_total`, where `alloc_total` is |
| 59 the sum of `size_total` of all rows. Therefore, `fraction` means |
| 60 out of all virtual pages, what fraction of them are inside an area |
| 61 of `size` pages whose underlying physical memory frames are contiguous. |
| 62 |
OLD | NEW |