Skip to content

Commit 23f1b88

Browse files
Merge pull request #2001 from madeline-underwood/page_size
Page size_JA to review
2 parents 35f642c + 53548ab commit 23f1b88

File tree

5 files changed

+73
-55
lines changed

5 files changed

+73
-55
lines changed

content/learning-paths/servers-and-cloud-computing/arm_linux_page_size/_index.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
---
2-
title: Explore Performance Gains by Increasing the Linux Kernel Page Size on Arm
3-
4-
draft: true
5-
cascade:
6-
draft: true
2+
title: Explore performance gains by increasing the Linux kernel page size on Arm
73

84
minutes_to_complete: 30
95

106
who_is_this_for: This is an introductory topic for developers who want to modify the Linux kernel page size on Arm-based systems to improve performance for memory-intensive workloads.
117

128
learning_objectives:
13-
- Verify the current page size on your system.
14-
- Install the 64K page size kernel specific to your OS.
15-
- Verify the new 64K page size is active.
16-
- Revert to the default 4K page size kernel (optional).
9+
- Explain the differences in page size configuration between Arm64 and x86 architectures.
10+
- Understand how page size affects memory efficiency and system performance.
11+
- Check the current memory page size on an Arm-based Linux system.
12+
- Install and boot into a Linux kernel configured with 64K page size support.
13+
- Confirm that the 64K page size is active.
14+
- Optionally revert to the default 4K page size kernel.
1715

1816
prerequisites:
19-
- An Arm-based Linux system running Ubuntu, Debian, or CentOS.
17+
- Access to an Arm-based Linux system running Ubuntu, Debian, or CentOS.
2018

2119
author: Geremy Cohen
2220

@@ -38,11 +36,11 @@ further_reading:
3836
link: https://amperecomputing.com/tuning-guides/understanding-memory-page-sizes-on-arm64
3937
type: documentation
4038
- resource:
41-
title: Page (computer memory) – Wikipedia
39+
title: Computer Memory, Wikipedia page
4240
link: https://en.wikipedia.org/wiki/Page_(computer_memory)
4341
type: documentation
4442
- resource:
45-
title: Debian Kernel Source Guide
43+
title: Network setup, Debian Kernel Source Guide
4644
link: https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_kernel_source
4745
type: documentation
4846
- resource:

content/learning-paths/servers-and-cloud-computing/arm_linux_page_size/centos.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ weight: 5
55
layout: learningpathall
66
---
77

8-
Follow the steps below to install a 64K page size kernel on [CentOS 9 or newer](https://www.centos.org/download/).
8+
Follow the steps below to install a 64K page size kernel on [CentOS 9 or later](https://www.centos.org/download/).
99

1010
## Verify the current page size
1111

12-
Verify you’re using a 4 KB pagesize kernel by entering the following commands:
12+
Verify you’re using a 4KB pagesize kernel by entering the following commands:
1313

1414
```bash
1515
getconf PAGESIZE
@@ -25,9 +25,9 @@ The output should be similar to below. The kernel flavor (the string after the v
2525

2626
The 4096 indicates the current page size is 4KB. If you see a value that is different, you are already using a page size other than 4096 (4K). On Arm systems, the valid options are 4K, 16K, and 64K.
2727

28-
## Install the 64k kernel package:
28+
## Install the 64K kernel package:
2929

30-
Enter the command below to install the 64k kernel:
30+
Enter the command below to install the 64K kernel:
3131

3232
```bash
3333
sudo dnf -y install kernel-64k
@@ -68,7 +68,7 @@ The output shows the 64k kernel is running:
6868
5.14.0-583.el9.aarch64+64k
6969
```
7070

71-
## Revert back to the 4K kernel
71+
## Revert to the 4K kernel
7272

7373
To revert to the original 4K kernel, enter the following:
7474

@@ -100,7 +100,7 @@ sudo grubby --set-default "$k4"
100100
sudo reboot
101101
```
102102

103-
Upon reboot, verify you’re on a 4 KB pagesize kernel by entering the following commands:
103+
Upon reboot, verify you’re on a 4KB pagesize kernel by entering the following commands:
104104

105105
```bash
106106
getconf PAGESIZE

content/learning-paths/servers-and-cloud-computing/arm_linux_page_size/debian.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ weight: 4
55
layout: learningpathall
66
---
77

8-
Follow the steps below to install a 64K page size kernel on [Debian 11 “Bullseye” or newer](https://www.debian.org/releases/bullseye/).
8+
Follow the steps below to install a 64K page size kernel on [Debian 11 “Bullseye” or later](https://www.debian.org/releases/bullseye/).
99

1010
Debian does not provide a 64K kernel package, so you will need to compile it from source.
1111

@@ -17,7 +17,7 @@ The instructions below use the Debian source package.
1717

1818
## Verify the current page size
1919

20-
Verify you’re using a 4 KB pagesize kernel by entering the following commands:
20+
Verify you’re using a 4KB pagesize kernel by entering the following commands:
2121

2222
```bash
2323
getconf PAGESIZE
@@ -100,11 +100,11 @@ The output shows the 64k kernel is running:
100100
6.12.22-64k
101101
```
102102

103-
This indicates the current page size is 64K, and you are using the new custom made 64k kernel.
103+
This indicates the current page size is 64K, and you are using the new custom-built 64k kernel.
104104

105-
## Revert back to the 4K kernel
105+
## Revert to the 4K kernel
106106

107-
To revert back to the kernel we started with, enter:
107+
To revert to the kernel we started with, enter:
108108

109109
```bash
110110
dpkg-query -W -f='${Package}\n' 'linux-image-*-64k*' 'linux-headers-*-64k*' \
@@ -127,4 +127,4 @@ The output should be similar to below -- the full kernel name may vary, but the
127127
6.1.0-34-cloud-arm64
128128
```
129129

130-
The 4096 indicates the current page size has been reverted to 4KB.
130+
The 4096 indicates the current page size has been reverted to 4 KB.

content/learning-paths/servers-and-cloud-computing/arm_linux_page_size/overview.md

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,72 @@
11
---
2-
title: Page Size Overview
2+
title: Overview
33
weight: 2
44
### FIXED, DO NOT MODIFY
55
layout: learningpathall
66
---
77

8-
## How does the CPU locate data in memory?
8+
## Page size fundamentals
99

10-
When your program asks for a memory address, the CPU doesn’t directly reach into RAM or swap space for it; that would be slow, unsafe, and inefficient.
11-
12-
Instead, it goes through the virtual memory system, where it asks for a specific chunk of memory called a page. Pages map virtual memory locations to physical memory locations in RAM or swap space.
10+
Before you modify the Linux kernel page size on an Arm system, you need to know what a page is, why size matters, and how size affects performance.
1311

1412
## What’s a memory page?
1513

16-
Think of your computer’s memory like a big sheet of graph paper. Each page is one square on that sheet. The page table is the legend that identifies which square (virtual address) maps to which spot in physical RAM. On x86, 4K is the only page size option, but Arm-based systems allow you to use 4K, 16K, or 64K page sizes to fine tune the performance of your applications.
14+
Think of your computer’s memory like a big sheet of graph paper. Each page is one square on that sheet.
15+
16+
The page table acts like a legend on the map, showing which virtual address square corresponds to a specific location in physical RAM. This mapping is managed by the operating system and the CPU’s Memory Management Unit (MMU).
17+
18+
To keep track of these mappings efficiently, CPUs use a fast lookup cache called the Translation Lookaside Buffer (TLB). Every access first attempts a TLB hit; a miss forces a page table lookup. If the page isn't already in the TLB, the CPU must fetch the mapping from memory—a process that adds latency and stalls execution.
19+
20+
On x86 systems, 4K pages are the standard, while Arm-based systems support multiple page sizes - typically 4K, 16K, or 64K. This flexibility allows developers to fine-tune performance for specific workloads.
1721

1822
This Learning Path explains how to switch between 4K and 64K pages on different Linux distributions.
1923

20-
## How should I select the memory page size?
24+
## How does the CPU locate data in memory?
2125

22-
Points to consider when thinking about page size:
26+
When your program accesses a memory address, the CPU doesn’t directly fetch data from RAM or swap space for it. That would be slow, unsafe, and inefficient. Direct physical access would bypass isolation and invalidate caches.
27+
28+
Instead, it goes through the virtual memory system, where it asks for a specific chunk of memory called a page. Pages map virtual memory locations to physical memory locations in RAM or swap space.
2329

24-
- **4K pages** are the safe, default choice. They let you use memory in small slices and keep waste low. Since they are smaller, you need more of them when handling larger memory footprint applications. This creates more overhead for the operating system to manage, but it may be worth it for the flexibility. They are great for applications that need to access small bits of data frequently, like web servers or databases with lots of small transactions.
30+
## How does page size affect performance?
2531

26-
- **64K pages** shine when you work with large, continuous data such as video frames or large database caches because they cut down on management overhead. They will use more memory if you don’t use the whole page, but they can also speed up access times for large data sets.
32+
Changing the page size has a cascading effect on system performance:
2733

28-
When selecting your page size, it's important to try both options under real-world conditions, as it will depend on the data size and retrieval patterns of the data you are working with.
34+
**Memory Fragmentation**: Smaller pages reduce internal fragmentation, which is the wasted memory per allocation. Larger pages can increase waste if your workloads don’t use the full page.
2935

30-
In addition, the page size may need to be reviewed over time as the application, memory usage patterns, and data sizes may change.
36+
**TLB Pressure**: With smaller pages such as 4K, more entries are needed to map the same amount of memory. This increases TLB misses and page-table-walk overhead. Larger pages, such as 64K, reduce the number of entries and can lower TLB pressure.
3137

38+
**I/O Efficiency**: Disk I/O and DMA operations often perform better with larger pages, because fewer page boundaries are crossed during transfers (fewer interrupts, larger DMA bursts).
3239

33-
### Summary of page size differences
40+
### Trade-offs to consider
3441

3542
| Aspect | 4K Pages | 64K Pages |
3643
|-----------------|--------------------------------------|----------------------------------------|
3744
| **Size** | Small “bricks” (4 KB each) | Big “bricks” (64 KB each) |
38-
| **Flexibility** | Very flexible—good for lots of tiny bits of data | Less flexible—best when data comes in large chunks |
45+
| **Flexibility** | Best for flexibility and compatibility | Best for large, contiguous memory workloads |
3946
| **Efficiency** | Needs more entries (more bookkeeping) | Needs fewer entries (less bookkeeping) |
40-
| **Waste** | At most 4 KB unused per page | Up to 64 KB unused if not fully used |
47+
| **Waste** | At most 4 KB unused per page | Up to ~63 KB unused if not fully used |
48+
| **TLB reach** | Lower, more misses | Higher, fewer misses |
49+
50+
This Learning Path covers switching between 4K and 64K page sizes because these are supported by most Arm Linux distributions. In some cases, you may find that 16K page size is a sweet spot for your application, but Linux kernel, hardware, and software support is limited. One example of 16K page size is [Asahi Linux](https://asahilinux.org/).
51+
52+
## How do I select the memory page size?
53+
54+
Points to consider when thinking about page size:
55+
56+
- **4K pages** are the safe, default choice. They let you use memory in small slices and keep waste low. Since they are smaller, you need more of them when handling larger memory footprint applications. This creates more overhead for the operating system to manage, but it may be worth it for the flexibility. They are great for applications that need to access small bits of data frequently, like web servers or databases with lots of small transactions.
57+
58+
- **64K pages** shine when you work with large, contiguous data such as video frames or large database caches because they cut down on management overhead. They will use more memory if you don’t use the whole page, but they can also speed up access times for large data sets.
59+
60+
Choosing the right page size depends on how your application uses memory, as both the data size and retrieval patterns of the data you are working with are influencing factors. Benchmark different options under real-world workloads to determine which delivers better performance.
4161

42-
This Learning Path covers switching between 4K and 64K page sizes because these are supported by most Arm Linux distributions. In some cases, you may find that 16K page size is a sweet spot for your application, but Linux kernel, hardware, and software support is limited. One example of 16k page size is [Asahi Linux](https://asahilinux.org/).
62+
In addition, the page size might need to be reviewed over time as the application, memory usage patterns, and data sizes might change.
4363

44-
## Experiment to see which works best for your workload
64+
## Try out a page size for your workload
4565

4666
The best way to determine the impact of page size on application performance is to experiment with both options.
4767

48-
{{% notice Do not test on Production%}}
49-
Modifying the Linux kernel page size can lead to system instability or failure. Perform testing in a non-production environment before applying to production systems.
68+
{{% notice Warning%}}
69+
Do not modify the Linux kernel page size in a production environment. It can lead to system instability or failure. Perform testing in a non-production environment before applying to production systems.
5070
{{% /notice %}}
5171

5272
Select the Arm Linux distribution you are using to find out how to install the 64K page size kernel.

content/learning-paths/servers-and-cloud-computing/arm_linux_page_size/ubuntu.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ weight: 3
55
layout: learningpathall
66
---
77

8-
Follow the steps below to install a 64K page size kernel on [Ubuntu 22.04 LTS or newer](https://releases.ubuntu.com/22.04/).
8+
To install a 64 K page size kernel on [Ubuntu 22.04 LTS or later](https://releases.ubuntu.com/22.04/), follow the steps below.
99

1010
## Verify the current page size
1111

12-
Verify you’re using a 4 KB pagesize kernel by entering the following commands:
12+
Verify you’re using a 4KB base-page-size kernel by entering the following commands:
1313

1414
```bash
1515
getconf PAGESIZE
@@ -23,7 +23,7 @@ The output should be similar to below. The kernel flavor (the string after the v
2323
6.1.0-34-cloud-arm64
2424
```
2525

26-
The 4096 indicates the current page size is 4KB. If you see a value that is different, you are already using a page size other than 4096 (4K). On Arm systems, the valid options are 4K, 16K, and 64K.
26+
The 4096 indicates the current page size is 4 KB. If you see a value that is different, you are already using a page size other than 4096 (4K). On Arm systems, the valid options are 4K, 16K, and 64K.
2727

2828
## Install the required dependencies and the 64K kernel
2929

@@ -34,15 +34,15 @@ sudo apt-get -y update
3434
sudo apt-get -y install git build-essential autoconf automake libtool gdb wget linux-generic-64k
3535
```
3636

37-
Next, run the following command to configure grub to load the 64K kernel by default:
37+
Next, run the following command to configure GRUB to load the 64K kernel by default:
3838

3939
```bash
4040
echo "GRUB_FLAVOUR_ORDER=generic-64k" | sudo tee /etc/default/grub.d/local-order.cfg
4141
```
4242

43-
## Update grub and reboot
43+
## Update GRUB and reboot
4444

45-
Commit your changes to grub and reboot by entering the following:
45+
Commit your changes to GRUB and reboot by entering the following:
4646

4747
```bash
4848
sudo update-grub
@@ -56,32 +56,32 @@ getconf PAGESIZE
5656
uname -r
5757
```
5858

59-
The output shows the 64k kernel is running:
59+
The output shows the 64K kernel is running:
6060

6161
```output
6262
65536
6363
6.8.0-59-generic-64k
6464
```
6565

66-
This indicates the current page size is 64K and you are running the new 64K kernel.
66+
This indicates that the current page size is 64K and that you are running the new 64K kernel.
6767

68-
## Revert back to the 4K kernel
68+
## Revert to the 4K kernel
6969

70-
To revert back to the original 4K kernel, run the following commands:
70+
To revert to the original 4K kernel, run the following commands:
7171

7272
```bash
7373
echo "GRUB_FLAVOUR_ORDER=generic" | sudo tee /etc/default/grub.d/local-order.cfg
7474
sudo update-grub
7575
sudo reboot
7676
```
77-
Upon reboot, verify you’re on a 4 KB pagesize kernel by entering the following commands:
77+
Upon reboot, verify you’re on a 4KB pagesize kernel by entering the following commands:
7878

7979
```bash
8080
getconf PAGESIZE
8181
uname -r
8282
```
8383

84-
The output shows the 4k kernel is running:
84+
The output shows the 4K kernel is running:
8585

8686
```output
8787
4096

0 commit comments

Comments
 (0)