CS680 Linux Kernel Programming

Homework 5 on Memory - Caching: kmalloc()

Implement a kernel routine that prints kernel cache-slubs with the fields described in /proc/slabinfo (which I showed briefly). Use kmalloc_caches[] for general purpose caches such as kmalloc-96, kmalloc-192, kmalloc-8, kmalloc-16, ..., kmalloc-2048, kmalloc-4096. You may skip special purpose caches but for those of you who are determined to print all caches as shown in /proc/slabinfo, use slab_caches (/mm/slub.c) to trace special caches such as files_cachep, signal_cachep, dentry_cache, etc.

Note: This routine needs to be inserted towards the end of kernel_init (PID1) so that a lot of caches will have been created by then.