
Define physical address space as the processor-accessible range of memory addresses, and show how 32-bit four gigabytes and 64-bit systems share this space with memory devices and peripherals.
Run a 32-bit buildroot image in qemu to examine physical memory and address space, and understand how devices, bios, and addresses are mapped in 64-bit emulation.
Discover how to view and adjust the RAM size in QEMU using /proc/meminfo and the free -m command, enabling accurate memory management for virtual machines.
The kernel shares its address space across all processes to avoid costly memory context switches. User space remains per-process, while system calls map memory into each process.
Examine the 64-bit memory map and the layout of userspace memory, and reference the documentation for details.
Learn how to convert virtual addresses to physical addresses in the Linux kernel, using documented format specifiers, and print actual versus unmodified addresses with BTX and kernel guidelines.
Explore how the linux kernel memory management divides virtual space into 4096-byte pages and maps them to physical frames via the memory management unit using page tables.
Examine how memory pages are represented in the Linux kernel using struct page, including page frames, references, and virtual addresses. Note that each page is 64 bytes.
explain how the Linux kernel uses paging and lazy userspace allocation, keeps kernel memory resident, and handles page faults, including minor and major faults.
Explore the user space virtual address space, including the text and data segments, heap, stack, and environment variables, with process maps to reveal memory layout.
Explain how the kernel virtual address space splits into low memory and high memory and how page tables map physical memory.
Explain how the Linux kernel maps physical memory into virtual space at boot, including a direct 896 MB mapping and the DMA and normal memory zones.
Learn to determine how much low mem and high mem you have, view total memory, and understand how ramp and off ramp settings affect memory allocation.
Explore how the Linux kernel allocates memory, from page level to the slab allocator, detailing four kilobyte pages and how slabs subdivide into 8, 16, and 32 byte chunks.
Explore kmalloc and kfree in the Linux kernel, explaining contiguous physical and virtual memory allocation, slab allocator usage, and GFP flag behavior, including memory leaks and proper freeing practices.
Explore how the Linux kernel partitions memory into dma, low memory, normal memory, and high memory zones on 32-bit and 64-bit systems, and inspect memory layout to verify these zones.
Explore how the Linux kernel uses zones and a buddy system allocator to manage physical memory, splitting memory into power-of-two page blocks and keeping per-order free lists to satisfy allocations.
Explore the virtual kernel memory layout, the memory map, and context mapping on 64-bit x86_64 systems, with reference to the documentation.
This lecture explains that virt_to_phys yields the physical address only for kernel directly mapped addresses, usually from kmalloc, and cannot resolve user-space virtual addresses.
Explore how the Linux kernel memory management maps virtual addresses to physical memory on a 64-bit system, illustrating address ranges, kibibyte conversions, and zone-based memory blocks through kmalloc concepts.
Learn how to determine the maximum single-call allocation size for kmalloc by doubling from 1 KiB until allocation fails, and how kmalloc max size and order influence this limit.
Explore how the ksize function reveals the actual memory allocated in the Linux kernel, showing that allocations may exceed requests within slab memory management.
kzalloc allocates memory in the Linux kernel and clears it to zero, preventing garbage values and ensuring zeroed memory on allocation.
Explore how the kmalloc function yields memory that is physically and virtually contiguous, outlining benefits for devices needing a physical contiguous block and the trade-offs of allocating large chunks.
Explore vmalloc in memory management within the Linux kernel. See how it provides a contiguous virtual space from non-contiguous physical memory via page tables.
Investigate the maximum vmalloc allocation size in memory management, demonstrating iterative attempts, GFP flags considerations, and why large allocations are only virtually contiguous rather than physically contiguous.
Explore vmalloc vs kmalloc in the linux kernel, noting kmalloc's physically contiguous allocations and vmalloc's non-contiguous memory, and discuss memory size, address space, and limits.
Explore the maximum vmalloc allocation on 32-bit Linux, and how practical physical memory limits constrain the theoretical size.
Explore why vmalloc used remains zero in the Linux kernel memory management, examining the single function that triggers the real operation and how memory areas are displayed in kilobytes.
Explore memory management in the Linux kernel, focusing on allocation practices and what the documentation says, and discuss the challenge of determining exact allocated memory without a direct query function.
Explore the maximum memory that can be allocated with vmalloc in the Linux kernel, and examine how the size in MB influences allocation behavior.
Analyze what happens when a vmalloc call allocates zero bytes in the Linux kernel, clarifying memory allocation behavior and edge cases in memory management.
Explore memory management in the linux kernel by examining the kernel stack, local variables, and dynamic allocations across processes, including stack frames and stack pool behavior.
Explore how the CONFIG_FRAME_WARN option triggers a warning when a function's stack usage exceeds a configured limit, such as 8192 bytes, and how to adjust default values.
Explore the check_stack.pl script as a static analysis tool to estimate stack usage in the Linux kernel memory management space, noting recursion is not considered.
This course offers a deep dive into the memory management of a Linux kernel, equipping you with practical knowledge and skills. You will first grasp the fundamental concepts of both physical and virtual address spaces for a processor and learn how to inspect them in a Linux environment. A key focus will be on the division of the virtual address space into distinct kernel and user spaces.
You'll gain an understanding of how the operating system handles memory in units called pages, and what triggers a page fault. The course will then detail the crucial process of converting a virtual address to a physical address, including the proper format specifiers for printing addresses.
Furthermore, you will explore the concepts of Low Memory and High Memory and the kernel's efficient Buddy Allocator for managing memory. You'll learn how to use the /proc/buddyinfo file to monitor memory zones. The course also covers dynamic memory allocation in the kernel using essential APIs like kmalloc and vmalloc, clarifying the differences between them and the various flags they use, such as GFP_KERNEL and GFP_ATOMIC. The course also addresses what happens when you attempt to allocate zero-sized memory. Lastly, you will examine the structure of the kernel stack and use the qemu-system-x86 command for practical exercises.