Skip to content

Commit 9803cdc

Browse files
committed
hugepages: add some details on allocation
This commit add a little more details on pre-allocation and dynamic allocation of huge pages on the node. It also links to the Linux documentation for further details but gives a quick example on multiple page sizes that is not very obvious from the Linux documentation currently. Signed-off-by: Anthony Nandaa <[email protected]>
1 parent e27d886 commit 9803cdc

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

content/en/docs/tasks/manage-hugepages/scheduling-hugepages.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,43 @@ by applications in a Pod. This page describes how users can consume huge pages.
1414

1515
## {{% heading "prerequisites" %}}
1616

17+
Kubernetes nodes must
18+
[pre-allocate huge pages](https://www.kernel.org/doc/html/latest/admin-guide/mm/hugetlbpage.html)
19+
in order for the node to report its huge page capacity.
1720

18-
1. Kubernetes nodes must pre-allocate huge pages in order for the node to report
19-
its huge page capacity. A node can pre-allocate huge pages for multiple
20-
sizes.
21+
A node can pre-allocate huge pages for multiple sizes, for instance,
22+
the following line in `/etc/default/grub` allocates `2*1GiB` of 1 GiB
23+
and `512*2 MiB` of 2 MiB pages:
24+
25+
```
26+
GRUB_CMDLINE_LINUX="hugepagesz=1G hugepages=2 hugepagesz=2M hugepages=512"
27+
```
2128

2229
The nodes will automatically discover and report all huge page resources as
2330
schedulable resources.
2431

32+
When you describe the node, you should see something similar to the following
33+
in the following in the `Capacity` and `Allocatable` sections:
34+
35+
```
36+
Capacity:
37+
cpu: ...
38+
ephemeral-storage: ...
39+
hugepages-1Gi: 2Gi
40+
hugepages-2Mi: 1Gi
41+
memory: ...
42+
pods: ...
43+
Allocatable:
44+
cpu: ...
45+
ephemeral-storage: ...
46+
hugepages-1Gi: 2Gi
47+
hugepages-2Mi: 1Gi
48+
memory: ...
49+
pods: ...
50+
```
2551

52+
> **NOTE:** For dynamically allocated pages (after boot), the Kubelet
53+
> needs to be restarted for the new allocations to be refrelected.
2654
2755
<!-- steps -->
2856

0 commit comments

Comments
 (0)