Docker container not using memory folios
Description
My laptop runs Ubuntu:22.04 LTS with the latest kernel image:
uname -a: Linux law 6.2.0-36-generic #37~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Oct 9 15:34:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Such a kernel image uses memory folios. Indeed, if I run:
strace tail -f /dev/null
I can spot the mmap syscall for the libc:
mmap(NULL, 2260560, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f7b48a00000
As you can see, my kernel gives me a huge page instead of a 4kb page. However, if I create a container with the same distro, i.e., Ubuntu:22.04, the memory page returned is a 4bk page instead of a huge one. Here the line of strace that returns a 4kb page:
mmap(NULL, 2260560, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb66550d000
Any guess? Can I somehow enable memory folios?
Reproduce
Dockerfile:
FROM ubuntu:22.04 RUN apt-get update && apt-get install -y strace
Commands:
docker build -t fail_folios .
docker run -it fail_folios
strace tail -f /dev/null
Memory pages returned are not huge pages.
Expected behavior
memory pages should
docker version
Client: Docker Engine - Community
Version: 24.0.7
API version: 1.43
Go version: go1.20.10
Git commit: afdd53b
Built: Thu Oct 26 09:07:41 2023
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 24.0.7
API version: 1.43 (minimum version 1.12)
Go version: go1.20.10
Git commit: 311b9ff
Built: Thu Oct 26 09:07:41 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.24
GitCommit: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
runc:
Version: 1.1.9
GitCommit: v1.1.9-0-gccaecfc
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
Client: Docker Engine - Community
Version: 24.0.7
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.11.2
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.21.0
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 60
Running: 1
Paused: 0
Stopped: 59
Images: 58
Server Version: 24.0.7
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
runc version: v1.1.9-0-gccaecfc
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.2.0-36-generic
Operating System: Ubuntu 22.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 31.2GiB
Name: law
ID: HT2S:5Y53:5SNR:3JJH:DKM5:C527:ZOTU:DPDO:J2GH:XQHM:TENY:6JIW
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
10.13.0.4:5000
registry.suite.mhackeroni.it:4998
registry.suite.mhackeroni.it:4999
registry.suite.mhackeroni.it:49999
registry.suite.mhackeroni.it:5000
127.0.0.0/8
Live Restore Enabled: false
Diagnostics ID
Not available
Additional Info
No response