Skip to content

Remove the CPU and NUMA topology code that never ran - #27

Merged
congwang-mk merged 3 commits into
mainfrom
remove-topology-stubs
Nov 30, 2026
Merged

congwang-mk merged 3 commits into
mainfrom
remove-topology-stubs

Conversation

@congwang-mk

Copy link
Copy Markdown
Contributor

Summary

kerf advertises CPU and NUMA topology support that it does not have. The placement options of kerf create, the models behind them and a whole document describe a feature whose input, a topology section in the baseline, nothing in kerf ever writes. This removes all of it until the support is real.

Three commits:

1. docs: Remove the CPU and NUMA topology document

Deletes docs/CPU_NUMA_TOPOLOGY.md and the README section and feature bullet that pointed at it.

2. create: Remove the topology placement options

Removes --cpu-affinity, --numa-nodes and --memory-policy and the three allocators. Without a topology section every policy made the same choice, a run of consecutive free CPU IDs or else the first free ones, so --cpu-count keeps exactly that. Instances are no longer created with the inert cpu-affinity, numa-nodes and memory-policy properties; the kernel does not read them.

3. Remove the topology models that nothing fills in

Removes the instance fields, the overlay code that wrote them, about 200 lines of validator checks, the TopologySection, NUMANode and CPUTopology models, the parser for the baseline topology section and the kerf show blocks that printed it. A baseline that carries a topology section still parses; the section is skipped.

Not changed

Per-node pool memory is a separate, working feature and is untouched: kerf init --memory=SIZE@N, the numa-node-id it writes, and the CPU to node lookup in topology.py that kerf init and kerf cpus use.

Relation to #12

#12 makes topology support functional and builds on the code removed here, so it will need a rebase and has to bring back the parts it uses. It also deletes docs/CPU_NUMA_TOPOLOGY.md itself.

User-visible changes

  • kerf create rejects --cpu-affinity, --numa-nodes and --memory-policy.
  • kerf show no longer prints a "NUMA Topology" block or, with -v, a per-CPU topology block. Neither could appear with a baseline written by kerf.

Testing

Full suite: 679 passed, 4 skipped. Pylint is clean. Tests that only built the removed objects by hand are deleted. Not run against a live multikernel host.

🤖 Generated with Claude Code

docs/CPU_NUMA_TOPOLOGY.md describes placement policies, a topology
section in the baseline and validation warnings as if they worked.
None of it does: nothing in kerf writes a topology section, so the
policies have nothing to act on. The README repeated the claim in its
feature list and in a section of its own.

Remove the document and what the README says about it. Per-node pool
memory, kerf init --memory=SIZE@N, is a different thing that does work,
and stays documented.

Signed-off-by: Cong Wang <cwang@multikernel.io>
--cpu-affinity, --numa-nodes and --memory-policy came with the first
kerf create and never did what their help says. They place CPUs by the
NUMA nodes of a topology section in the baseline, and nothing in kerf
writes that section, so every policy fell through to the same choice:
a run of consecutive free CPU IDs, or else the first free ones. local
was the exception, it could only fail.

Remove the options and the three allocators, and keep that one choice
for --cpu-count. An instance is no longer created with the properties
the options left behind, of which cpu-affinity = "compact" was written
for every instance because the option defaulted to it. The kernel does
not read any of them.

Signed-off-by: Cong Wang <cwang@multikernel.io>
With the options of kerf create gone, the rest of the topology code
has no way to run.

An instance had numa_nodes, cpu_affinity and memory_policy, which only
those options set. The overlay wrote them out, the update overlay
pinned added CPUs and memory to the first of numa_nodes, and the
validator checked them against the topology of the baseline in some
200 lines.

The baseline had a topology section of NUMA nodes and a per-CPU record
of socket, core and thread. The parser read the first from a section
that kerf never writes, nothing set the second, and kerf show printed
both when they were there.

Remove all of it, with the tests that built these objects by hand. A
baseline that carries a topology section is still parsed, the section
is skipped. kerf show loses a verbose argument for the baseline, which
only the per-CPU record used.

The NUMA node of pool memory is not part of this: kerf init
--memory=SIZE@N, the numa-node-id it writes and the lookup of a CPU's
node in topology.py are unchanged.

Signed-off-by: Cong Wang <cwang@multikernel.io>
@congwang-mk
congwang-mk merged commit 0cbfe5a into main Nov 30, 2026
8 checks passed
@congwang-mk
congwang-mk deleted the remove-topology-stubs branch November 30, 2026 00:53
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.

1 participant