Skip to content

kernel: trim what small, short-lived VMs don't need - #83

Merged
fcuny merged 2 commits into
mainfrom
claude/project-thread-39j0cn
Nov 3, 2026
Merged

fcuny merged 2 commits into
mainfrom
claude/project-thread-39j0cn

Conversation

@fcuny

@fcuny fcuny commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

c2vm gives a VM 512 MiB by default and keeps it for one job, so memory and boot time count more than what these options buy a single-tenant guest. The changes come from a write-up on shrinking NixOS to 512 MB, filtered down to what our config doesn't already cover (we ship no modules, and KFENCE, memory profiling and TPM are already off).

  • THP on madvise (was always). The author measured 52 MB freed at 2 GB with THP off, and always raises min_free_kbytes a lot.
  • No KSM, so no ksmd thread. A single guest has little to merge.
  • No crypto self-tests. They run at each boot.

All three go in c2vm.fragment, so update.sh keeps them across releases.

Testing

I edited configs/7.3/aarch64.config by hand: this environment couldn't reach kernel.org or Debian to run update.sh. The kernel workflow's build.sh runs olddefconfig and fails if Kconfig disagrees with the config, so a green build confirms the edit. The one to watch is CRYPTO_MANAGER, whose default depends on CRYPTO_SELFTESTS.

Before merging: kernel/test/pr.py <this PR> on a Mac. It would also help to compare free -m at idle before and after.

🤖 Generated with Claude Code

c2vm's VMs get 512 MiB by default and live for one job, so memory and
boot time count more than what these options buy a single-tenant guest:

- Transparent huge pages only on madvise: "always" raises
  min_free_kbytes and holds memory a small VM needs.
- No KSM, and so no ksmd thread: one guest has little to merge.
- No crypto self-tests: they run at each boot.

They go in c2vm.fragment, so update.sh keeps them across releases.
The config was edited by hand: the kernel workflow's olddefconfig check
confirms Kconfig agrees with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGT1ESdJ8nAumniwetwZfu
@fcuny fcuny self-assigned this Nov 3, 2026
olddefconfig drops it once CRYPTO_SELFTESTS is off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGT1ESdJ8nAumniwetwZfu
@fcuny

fcuny commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Tested 7.3.1 from the kernel workflow's run for 7bc8fd2, with kernel/test/pr.py and c2vm at v0.1.0-59-gbb89948: everything passed.

Check
boots, and runs the checks within 300s ✅
uname -r is 7.3.1-c2vm ✅
/proc/sys is there ✅
sees 4 CPUs ✅
gets an address over DHCP ✅
fetches over HTTPS ✅
the root is the overlay ✅
the random device is virtio ✅
reads a -v mount ✅
no errors in dmesg ✅
make e2e: 13 passed ✅

@fcuny
fcuny merged commit 7cb788c into main Nov 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants