kernel-memory-management

kernel-memory-management is a skill for Claude Code, Codex from mohitmishra786/low-level-dev-skills. It costs 65 tokens per session (906 once invoked), scanned A, original, MIT.

A guide to how Linux allocates and maps memory inside the kernel. It explains physical pages, kmalloc, vmalloc, DMA buffers, memory zones, and the SLUB allocator.

In plain words
What is it for?
Use it when writing kernel or driver code, allocating DMA memory, choosing between kmalloc and vmalloc, or debugging allocator and memory-zone problems.
Why use it?
It helps choose an allocation method that fits the buffer size, hardware, and execution context. It also supports investigation of out-of-memory errors and memory corruption.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when writing kernel or driver code, allocating DMA memory, choosing between kmalloc and vmalloc, or debugging allocator and memory-zone problems.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mohitmishra786/low-level-dev-skills/kernel-memory-management
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mohitmishra786/low-level-dev-skills --skill kernel-memory-management
Clone the repo
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for kernel-memory-management

README.md
[![agentmods](https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/kernel-memory-management/github.svg)](https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/kernel-memory-management)
Your own site
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/kernel-memory-management"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/kernel-memory-management/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for kernel-memory-management

Your own site · 80×15
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/kernel-memory-management"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/kernel-memory-management.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 906 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00065 $0.00906
Opus 5 $0.00032 $0.00453
Sonnet 5 $0.00013 $0.00181
Haiku 4.5 $0.00006 $0.00091

Measured 8d ago against content hash 83c9e749de79, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

kernel-memory-management scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/kernel-dev/kernel-memory-management/SKILL.md · 107 lines

How it starts

The opening of the file, as written. The whole thing — 107 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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); the legacy SLAB allocator was removed in Linux 6.12.

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

void *v = vmalloc(size);  /* virtually contiguous, physically scattered */
vfree(v);

Use for large buffers where contiguous physical pages are unnecessary. Do not use for DMA without dma_map_*.

4. Buddy page allocator

struct page *page = alloc_pages(GFP_KERNEL, order);
void *addr = page_address(page);
__free_pages(page, order);

order n allocates 2^n pages. Zone selection: ZONE_DMA, ZONE_NORMAL, ZONE_MOVABLE (see include/linux/mmzone.h).

5. NUMA basics

On NUMA systems, kmalloc prefers local node; use alloc_pages_node() or mbind policies for HPC paths — see skills/allocators/numa-programming.

Read the full file on GitHub · 107 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 107 lines · 65 tokens per session scan A 83c9e749de79

Subscribe to this mod's changes

kernel-memory-management is a skill published in the GitHub repository mohitmishra786/low-level-dev-skills (203 stars, last pushed 2mo ago), licensed MIT. It adds 65 tokens to every session and 906 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

gke-ai-troubleshooting-tpu-dynamic-slices-monitoring

Monitors, troubleshoots, and manages GKE TPU Dynamic Slices custom resources. Use when checking TPU slice lifecycle states, troubleshooting slice provisioning failures, validating single-slice or multi-slice (JobSet) workload manifests, or safely patching stuck finalizers and disabling the slice controller. Don't use…

google/skills · 107 tokens

doca-flow

Build and debug DOCA Flow applications on supported NVIDIA NICs/DPUs: define match/action pipes, initialize ports and representors, choose forwarding targets, validate pipes before hardware programming, read counters, match the Flow version to the installed DOCA release, and diagnose Flow API errors. Trigger on DOCA…

NVIDIA/skills · 140 tokens

diagnose-driver-install

Diagnose NVIDIA driver installation failures on DeepOps-managed nodes — nvidia-smi errors, "No devices were found", DKMS build failures, or GPU pods crash-looping. Use before reinstalling anything.

NVIDIA/deepops · 47 tokens

ipfabric

Skill: /ipfabric MCP Server: ipfabric-mcp (remote HTTP via mcp-remote) Tools: 10 (health, path lookups, diagrams, API discovery).

automateyournetwork/netclaw · 0 tokens

gtrace-path-analysis

Network path tracing and monitoring — traceroute with MPLS/ECMP/NAT detection, continuous MTR monitoring, and distributed GlobalPing probes from 500+ worldwide locations. Use when tracing the path to a destination, diagnosing slow network routes, detecting MPLS or ECMP load balancing, running MTR for intermittent…

automateyournetwork/netclaw · 80 tokens

eide

A build tool for EIDE projects, an embedded-development extension for Visual Studio Code. It finds EIDE project settings and builds firmware using ARM CC or GCC.

zhinkgit/embeddedskills · 151 tokens