Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Kernel Internals

ASecurity

Use when diagnosing scheduler latency, kmalloc vs vmalloc, page cache, meminfo under pressure, or OOM victim choice, or when reading kernel/sched, mm, or fs source.

54 stars
0 votes
0 copies
0 views
Added 9/20/2026
ai-agentsrustnodeapiperformance

Works with

api

Security Analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned 9/20/2026

$npx -y skills add OutlineDriven/outline-driven-development --skill kernel-internals --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Kernel Internals?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Kernel Internals
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/outlinedriven-kernel-internals-outline-driven-development/badge)](https://www.skillsdirectory.com/skills/outlinedriven-kernel-internals-outline-driven-development)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: kernel-internals
description: 'Use when diagnosing scheduler latency, kmalloc vs vmalloc, page cache, meminfo under pressure, or OOM victim choice, or when reading kernel/sched, mm, or fs source.'
---

# Kernel internals

## Contract

| Field | Bound contract |
|---|---|
| Trigger | A diagnosis or explanation inside the scheduler, the memory allocators, the VFS, the page cache, or the OOM killer; also reading kernel source in `kernel/sched/`, `mm/`, or `fs/`. |
| Authority | Read-only. Analysis and measurements stay in chat; no file writes, no rollback needed. No remote mutation. |
| Side effect | A subsystem diagnosis grounded in the running kernel's version and measurements. Nothing is written. |
| Done | The observed behavior is explained by one subsystem mechanism with the measurement that confirms it, or the mismatch between the claim and the kernel is named. |

## Inputs

1. The question or symptom (required): latency, allocation failure, cache behavior, memory pressure, OOM victim.
2. Target access (optional): `/proc`, `/sys`, and `perf` on the running machine.
3. Kernel version (optional): mainline 7.2 or LTS 6.18 assumed when not stated.

## Procedure

1. **Pin the kernel and the scheduler it runs.** `uname -r` first. EEVDF (Earliest Eligible Virtual Deadline First) replaced CFS: merged as an option in 6.6, the transition completed in 6.12, so mainline 7.2 and LTS 6.18 run EEVDF. On 6.6 through 6.11, check which one is active before applying CFS reasoning. Each CPU carries a runqueue with three classes:

   ```
   Per-CPU runqueue (struct rq)
   +-- cfs_rq  fair-class tasks ordered by eligibility and deadline
   +-- rt_rq   real-time tasks (FIFO/RR)
   +-- dl_rq   SCHED_DEADLINE tasks
   ```

   Done when: the kernel version and the active fair scheduler are recorded.
2. **Measure scheduling before touching anything.** `chrt -p <pid>` reads the class, `/proc/<pid>/sched` the per-task counters, `/sys/kernel/debug/sched/debug` the runqueue state, and `perf sched record` with `perf sched latency` the delay picture. The old CFS sysctls (`kernel.sched_latency_ns`, `kernel.sched_min_granularity_ns`, `kernel.sched_wakeup_granularity_ns`) were removed in 6.12 with EEVDF; they exist only on pre-6.12 kernels. `vruntime` is virtual runtime: CPU time consumed, normalized by weight. Under EEVDF a task with positive lag is eligible and the earliest eligible virtual deadline wins. Done when: one measurement names the unfair or slow path.
3. **Read the buddy allocator from `/proc`.** Physical pages are handed out in power-of-two orders; order 0 is one page, 4 KiB on default x86-64 and arm64 configs. `/proc/buddyinfo` shows free blocks per order and zone, `/proc/zoneinfo` the per-zone counts. `ZONE_HIGHMEM` exists on 32-bit and selected configs only; on 64-bit x86-64 and arm64 essentially all RAM sits in `ZONE_NORMAL`. Done when: the fragmentation picture comes from `buddyinfo`, not from a guess.
4. **Pick the allocation API by the constraint that binds.**

   | API | Use when |
   |---|---|
   | `kmalloc(size, GFP_KERNEL)` | Physically contiguous, size bounded by `KMALLOC_MAX_SIZE` (arch dependent) |
   | `kzalloc(size, flags)` | Zeroed `kmalloc` |
   | `vmalloc(size)` | Virtually contiguous, large, may be physically fragmented |
   | `__get_free_pages(gfp, order)` | Direct page-granular allocation |

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

   Done when: the chosen API matches the contiguity and size bound the caller actually needs.
5. **Read VFS pressure through its caches.** A path lookup walks the dentry cache, the inode carries metadata and ops, and `struct file` holds per-open state. `/proc/mounts` lists mounts, `vm.vfs_cache_pressure` sets how eagerly the dentry and inode caches are reclaimed (higher reclaims sooner), and `/proc/<pid>/fd` counts open files. Done when: cache pressure is distinguished from file-leak pressure.
6. **Judge the page cache with the writeback state.** `Cached` in meminfo is page cache and tmpfs; `Dirty` pages wait for writeback. `blockdev --getra` reads the readahead window and `--setra` changes it per device. `echo 3 > /proc/sys/vm/drop_caches` after `sync` drops caches for benchmarking only; it is destructive to performance and proves nothing in steady state. Done when: cache and dirty state are read together.
7. **Interpret `/proc/meminfo` field by field.**

   | Field | Meaning |
   |---|---|
   | `MemTotal` | Total usable RAM |
   | `MemFree` | Completely unused pages |
   | `MemAvailable` | Estimated allocatable memory including reclaimable cache |
   | `Cached` | Page cache and tmpfs |
   | `Buffers` | Block device metadata cache |
   | `SwapTotal` / `SwapFree` | Swap space |
   | `Dirty` | Pages pending writeback |
   | `AnonPages` | Anonymous heap and stack pages |
   | `Slab` | Kernel object cache |
   | `SReclaimable` / `SUnreclaim` | Slab split by reclaimability |

   ```
   MemAvailable low + Cached high -> reclaim page cache, pressure is not fatal
   AnonPages high + SwapFree low  -> OOM risk
   Slab huge                      -> kernel object leak, check /proc/slabinfo
   Dirty high                     -> writeback lag, check the I/O scheduler
   ```

   Done when: the pressure verdict comes from two or more fields read together.
8. **Explain the OOM pick, then move the pick.** The killer scores candidates from memory use, child processes, and `oom_score_adj` (-1000 to 1000). Protect a daemon by lowering its adj; cap a service with a cgroup `memory.max` instead of tuning adj upward for everyone else. Events land in `dmesg` and `journalctl -k`. Done when: the victim choice is explained and the correction is in place for the next episode.

## Failure and recovery

| Symptom | Cause | Fix |
|---|---|---|
| `kmalloc: allocation failed` | Fragmentation or size over `KMALLOC_MAX_SIZE` | Use `vmalloc`, reduce pressure, reserve `GFP_ATOMIC` for non-sleeping paths |
| High iowait with low `MemAvailable` | Page cache thrashing | Add RAM or cut the working set, tune `vfs_cache_pressure` last |
| OOM kills the wrong process | Big user with a neutral adj | Set `oom_score_adj`, cap with `memory.max` |
| Unfair scheduling | Real-time starving the fair class | `chrt` audit, `isolcpus` to split CPUs |
| SLUB corruption | Use-after-free in a module | `KASAN`, `slub_debug=P` |
| Slow file reads | Readahead window too small | Raise readahead, check the backing device |

| Failure class | Behavior |
|---|---|
| The claim contradicts the running kernel | Trust the kernel: re-read the sysctl or counter, and restate the claim with the version attached. |
| A tunable is missing | The version removed it (EEVDF removed the CFS sysctls in 6.12); do not advise it for newer kernels. |
| Two metrics disagree | Measure again under the same load before explaining; never average across episodes. |

## Output

1. The mechanism that explains the observation.
2. The measurements that confirm it, with the kernel version attached.
3. The specific correction to apply.

Attribution

OutlineDrivenOutlineDriven
View sourceSee grades on GitHubMore from OutlineDriven →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →