varnish / varnish/tinykvm

VmGroup: pool forks of one master into a shared struct kvm

Open
#91 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
821
Forks
23
PR merge metrics
No merged PRs in 30d

Description

I've been running a KVM_CREATE_VM-elimination line on the fast-agent branch and want to upstream it.

Problem: at high fork churn, per-fork VM create/destroy dominates, each KVM_CREATE_VM pays mm_take_all_locks plus a PM-notifier registration on a global rwsem whose chain walk is O(live VMs). Mass termination and warm-fill decay measurably past ~10k live VMs.

A VmGroup owns one KVM VM and hands out seats (vcpu fd, kvm_run mapping, POSIX timer, arena GPA partition in one MAP_NORESERVE window) to pooled forks of one master. One KVM_CREATE_VM per B forks instead of per fork; zero memslot ops and zero mmaps in a live group's steady state; host VMAs flat at ~10k out to 100k members. Feature-gated (MachineOptions::vm_group), default off; the whole suite also passes with it forced on. Pooled members refuse remote/IPRE, SMP, hugepages, reset_to_new_master, foreign-range deletes.

11 commits, rebased onto current master. Proposed ladder:

  1. KVM_RUN failure classification by whether the timeout timer fired
  2. lazy per-fork kvm_run mapping + cpu_id → kvm_vcpu_id/guest_cpu_index split
  3. VmGroup core, x86-64 (4 commits: pooling, lifecycle/PTE-partition invariant, one host mapping per group, one memslot per group)
  4. ARM64 port (3 commits; the PTE-partition invariant stays AMD64-only)

One PR each, 3 before 4. Object here if the seats-in-one-struct-kvm direction is wrong before we open them.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the fast-agent branch and the 11 commits, beginning with KVM_RUN failure classification and the lazy kvm_run mapping work. Then examine the proposed x86-64 and ARM64 VmGroup ladder, including the seat, lifecycle, PTE-partition, host-mapping, and memslot invariants; done means deciding whether the shared-struct-kvm direction is suitable before separate PRs are opened.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
operating-systems, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.