Kernel Memory Management

Kernel memory management skill for Linux mm subsystem. Use when using kmalloc, vmalloc, page allocator, SLUB, or debugging OOM and memory zones. Activates on queries about buddy allocator, kmalloc sizes, vmalloc vs kmalloc, SLUB, memory zones, or kernel OOM.

293 stars 36 forksProductivity & Notes

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add mohitmishra786/low-level-dev-skills --skill kernel-memory-management
Manual install
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills.git /tmp/low-level-dev-skills
mkdir -p ~/.claude/skills
cp -r /tmp/low-level-dev-skills/skills/kernel-dev/kernel-memory-management ~/.claude/skills/kernel-memory-management

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Kernel Memory Management

## Purpose

Guide agents through Linux kernel memory allocation: physical page allocator (buddy), SLUB kmalloc caches, vmalloc virtual mappings, zones (DMA/Normal), and safe allocation patterns in drivers — extending `skills/kernel/kernel-internals`.

## When to Use

- Choosing `kmalloc` vs `vmalloc` vs `get_free_pages`
- Debugging kernel OOM or slab corruption
- DMA buffer allocation requirements
- Understanding `/proc/meminfo` and slab stats

## Workflow

### 1. Allocator decision tree

```
Need physically contiguous memory for DMA?
├── Yes → dma_alloc_coherent() or CMA pool
└── No
    ├── Size ≤ ~128K (arch-dependent) → kmalloc / kzalloc
    ├── Large or non-contiguous OK → vmalloc / vzalloc
    └── Whole pages → alloc_pages() / __get_free_pages()
```

### 2. kmalloc and SLUB

SLUB is the default general-purpose kmalloc backend (per [kernel memory allocation guide](https://docs.kernel.org/core-api/memory-allocation.html)); the legacy SLAB allocator was removed in Linux 6.12.

```c
void *buf = kmalloc(size, GFP_KERNEL);
if (!buf)
    return -ENOMEM;
/* ... */
kfree(buf);
```

| GFP flag | Context |
|----------|---------|
| `GFP_KERNEL` | Process context, may sleep |
| `GFP_ATOMIC` | IRQ / holding spinlock — smaller pools |
| `GFP_DMA` | DMA zone (legacy 32-bit devices) |

Check `/proc/slabinfo` and `cat /sys/kernel/slab/*/object_size`.

### 3. vmalloc

```c
void *v = vmalloc(size);  /* virtually contiguous, physically scattered */
vfree(v);
```
Read the full skill on GitHub

Details

Skill name
kernel-memory-management
Path
skills/kernel-dev/kernel-memory-management/SKILL.md
License
MIT
Repo updated
14 November 2026

FAQ

What does the Kernel Memory Management skill do?

Kernel memory management skill for Linux mm subsystem. Use when using kmalloc, vmalloc, page allocator, SLUB, or debugging OOM and memory zones. Activates on queries about buddy allocator, kmalloc sizes, vmalloc vs kmalloc, SLUB, memory zones, or kernel OOM.

How do I install the Kernel Memory Management skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add mohitmishra786/low-level-dev-skills --skill kernel-memory-management. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Kernel Memory Management popular?

It lives in mohitmishra786/low-level-dev-skills, which has 293 GitHub stars and 36 forks.

Related skills

Abi and Calling Conventions

293

mohitmishra786/low-level-dev-skills

ABI and calling conventions skill for cross-language boundaries. Use when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Activates on queries about calling convention, ABI, System V AMD64, AAPCS, stack frame, variadic function, or FFI registers.

Software Development36

Adc Dac Baremetal

293

mohitmishra786/low-level-dev-skills

Bare-metal ADC and DAC skill. Use when configuring analog sampling, DMA-driven ADC, calibration, or DAC output on MCUs. Activates on queries about ADC bare-metal, sampling time, DMA ADC, or DAC channel setup.

Other36

Af Xdp

293

mohitmishra786/low-level-dev-skills

AF_XDP skill for high-performance XDP sockets. Use when creating AF_XDP sockets, configuring UMEM and XSK rings, XDP_REDIRECT programs, copy vs zero-copy mode, or comparing with DPDK. Activates on queries about AF_XDP, xsk_umem, XDP_REDIRECT, libbpf xsk, or zero-copy XDP.

Software Development36

Linker Scripts

293

mohitmishra786/low-level-dev-skills

Linker script skill for embedded bare-metal targets. Use when writing or modifying GNU ld linker scripts, placing code and data in specific flash or RAM regions, understanding VMA vs LMA, configuring startup .bss/.data initialization, using MEMORY and SECTIONS commands, or debugging linker errors about regions. Activates on queries about linker scripts, MEMORY command, SECTIONS command, .bss init, VMA vs LMA, weak symbols, or placing functions in specific memory regions.

Productivity & Notes36

Kernel Internals

293

mohitmishra786/low-level-dev-skills

Linux kernel internals skill for scheduler, memory, and VFS subsystems. Use when analyzing CFS/EEVDF scheduling, buddy/SLUB allocators, page cache, memory zones, OOM killer, or interpreting /proc/meminfo. Activates on queries about kernel scheduler, vruntime, SLUB, vmalloc, page cache, or OOM killer.

Productivity & Notes36

Memory Hierarchy and Caches

293

mohitmishra786/low-level-dev-skills

Memory hierarchy skill for caches, coherence, and locality. Use when explaining cache levels, associativity, false sharing, prefetching, or MESI coherence. Activates on queries about cache hierarchy, L1 L2 L3, false sharing, cache line, prefetch, or cache coherence.

Productivity & Notes36

Browse the most popular Claude skills, all productivity & notes skills, or write your own with the skills generator.