This project is part of coursework for CS 5565 - Advanced Linux Kernel Programming at Virginia Tech (Project Specification)
The goal of this assignment is to track memory access patterns of a userspace programs through a kernel module that tracks page access frequency.
| File | Description |
|---|---|
| memalloc.c | A user-space program that allocates a 1GB memory region. It writes the virtual address of the allocated block to the kernel module’s /proc file. The program also simulates different memory access patterns:- Reads all pages in [0, 256MB] sequentially and continuously as fast as possible. - Reads all pages in [256MB, 512MB] every 1 ms to replicate a slower access region. |
| page-walker-kmod.c | A Linux kernel module that spawns two kernel threads: - scanner kthread: Periodically scans the access (A) bit of all 4KB pages in the 1GB buffer and aggregates access counts every 100 ms. - logger kthread: Access frequency data is periodically logged to kernel log every 1s using printk, viewable via dmesg or /var/log/kern.log. |
| helper.c | A collection of helper functions derived from MoatLab’s LeapIO project. |
make
sudo insmod page-walker-kmod.kogcc memalloc.c -o memalloc
sudo ./memallocdmesg | tail -n 50sudo rmmod page-walker-kmod- Virtual-to-physical page mapping
- Walking page table in the Linux kernel
- Access bit (A-bit) scanning
- Kernel threading and synchronization
- User-kernel communication through
/proc