Memory
Basic
https://en.wikipedia.org/wiki/PCI_configuration_space
The system's firmware, device drivers or the operating system program the Base Address Registers (commonly called BARs) to inform the device of its address mapping by writing configuration commands to the PCI controller.
https://stackoverflow.com/questions/1477885 Anon blocks are "large" blocks allocated via malloc or mmap
https://stackoverflow.com/questions/79923 The stack is the memory set aside as scratch space for a thread of execution. The heap is memory set aside for dynamic allocation. Each thread gets a stack, while there's typically only one heap for the application
https://linux-mm.org/LinuxMMDocumentation
cgroup
http://elixir.free-electrons.com/linux/latest/source/Documentation/cgroup-v1/memory.txt
Memory Management Unit (MMU)
https://cseweb.ucsd.edu/classes/su09/cse120/lectures/Lecture7.pdf
kmalloc & vmalloc
https://static.lwn.net/images/pdf/LDD3/ch08.pdf
System Management Mode (SMM)
http://invisiblethingslab.com/resources/misc09/smm_cache_fun.pdf
Memory Map
system memory
Legacy Region
Firmware Perspective - Platform Initialization (PI) specification
Pre-EFI-initialization (PEI) phase
no memory map term in PEI phase. The “memory map” concept is reported by in PEI Hand-of-Block (HOB).
Driver eXecution Environment (DXE) Phase
Global Coherency Domain Services (GCD) are used to manage the memory and I/O resources visible to the boot processor, including GCD memory space map, and GCD IO space map.
OS Perspective
GetMemoryMap() interface returns an array of UEFI memory descriptors. no UEFI memory map for S3 resume, because S3 resume only has PEI phase. The memory map should NOT be changed in S4 resume phase, because OS restores the system memory from disk directly.
legacy ACPI specification: INT15 E820H function call, or E820 table.
The difference is that E820 table does not have runtime concept, so memory mapped I/O and memory mapped I/O port space allowed for virtual mode calls to UEFI run-time functions does not exist.
dmesg
/proc/iomem
with related e820/efi/ACPI dmesg
free
drop_caches
/proc/meminfo
https://www.kernel.org/doc/Documentation/filesystems/proc.txt https://github.com/torvalds/linux/blob/master/fs/proc/meminfo.c#L69 https://access.redhat.com/solutions/406773
/proc/vmallocinfo
/proc/PID/maps
pmap
Global Graphics Translation Table (GTT)
address mapping from the GPU virtual address space to physical addresses.
KVM MMU Virtualization
https://events.static.linuxfound.org/slides/2011/linuxcon-japan/lcj2011_guangrong.pdf
GFN: Guest Frame Number PFN: Host Page Frame Number
GPA: Guest Physical Address HVA: Host Virtual Address HPA: Host Physical Address
Hard MMU • NPT on SVM from AMD • EPT on VMX from Intel
Hardware
lshw -C memory
Numa
numactl -H available: 2 nodes (0-1) node 0 cpus: 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 node 0 size: 16053 MB node 0 free: 149 MB node 1 cpus: 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 node 1 size: 16122 MB node 1 free: 78 MB node distances: node 0 1 0: 10 20 1: 20 10
Hugepages
https://wiki.debian.org/Hugepages#Enabling_HugeTlbPage bigger pages, the CPU/OS have less entries to look-up
sudo sysctl -w vm.nr_hugepages=128
/etc/security/limits.conf # Exit and re-login to take effect.
soft memlock 262144
hard memlock 262144
vi /root/.bashrc ulimit -u unlimited
apt install hugepages -y hugeadm --pool-list Size Minimum Current Maximum Default 2097152 0 0 0 * 1073741824 0 0 0
grep Huge /proc/meminfo AnonHugePages: 18466816 kB ShmemHugePages: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB Hugetlb: 0 kB
grep -R "" /sys/kernel/mm/hugepages/ /proc/sys/vm/huge /sys/kernel/mm/hugepages/hugepages-2048kB/free_hugepages:0 /sys/kernel/mm/hugepages/hugepages-2048kB/resv_hugepages:0 /sys/kernel/mm/hugepages/hugepages-2048kB/surplus_hugepages:0 /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages_mempolicy:0 /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages:0 /sys/kernel/mm/hugepages/hugepages-2048kB/nr_overcommit_hugepages:0 /sys/kernel/mm/hugepages/hugepages-1048576kB/free_hugepages:0 /sys/kernel/mm/hugepages/hugepages-1048576kB/resv_hugepages:0 /sys/kernel/mm/hugepages/hugepages-1048576kB/surplus_hugepages:0 /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages_mempolicy:0 /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages:0 /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_overcommit_hugepages:0 /proc/sys/vm/hugetlb_shm_group:0 /proc/sys/vm/nr_hugepages:0 /proc/sys/vm/nr_hugepages_mempolicy:0 /proc/sys/vm/nr_overcommit_hugepages:0
Last updated
Was this helpful?