kernel: CONFIG_CFS_BANDWIDTH is off, so cpu.max cannot cap an execution

Open Beginner friendly
#1,193 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
linux, rust

Research direction

The change is a kernel config option, so start at the microVM kernel config under kernel/config-microvm and find the # CONFIG_CFS_BANDWIDTH is not set line. Enable it, then confirm that writing cpu.max into a guest cgroup succeeds on a booted kernel. Done means the option is set and the reporter's cpu.max write no longer fails; check whether the build pipeline also needs a rebuild step.

Written by the indexing model from the issue text.

Description

What

An adapter that runs sandboxed executions in the guest can cap memory.max and pids.max of an execution's cgroup but not its CPU time: the kernel in kernel/config-microvm has # CONFIG_CFS_BANDWIDTH is not set, so writing cpu.max fails.

Why this might matter here

#912 discusses the cost of one cgroup per execution and the limits of one cgroup for all executions. A per-execution CPU cap would need cpu.max, which needs this option. I did not find an issue or PR that asks for it (searched cpu.max, CFS, CPU limit cgroup).

Evidence (one machine, an external adapter, not the upstream agent)

With a kernel built from the same 6.18.38 sources and patches plus CONFIG_CFS_BANDWIDTH=y, a guest agent that writes cpu.max into an execution's cgroup limited a busy loop to 0.51 CPU for a 50 % limit (1.00 CPU with no limit). With the upstream release kernel the same request fails at start. I have not measured the size or boot-time cost of the option.

Proposal

Enable the option (one line, PR follows). Whether the upstream managed agent should expose cpu.max is a separate question; I am not asking for that here.

Dominant language
Rust
Stars
758
Forks
48
Avg merge
17h 50m
Merged PRs (30d)
450

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from microsoft/nvx

All issues in microsoft/nvx

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.