Version: 1.0
License: GPL v2
Status: Experimental
SLM Kernel is a production-ready architecture that integrates a Small Language Model (SLM) directly into a custom Linux Kernel ecosystem to perform real-time autonomic system management.
- Real-time Detection - Identify kernel-level errors (MCEs, OOM kills, I/O bottlenecks) with sub-millisecond latency
- Intelligent Analysis - Use ML inference with sub-10ms latency for root-cause analysis
- Safe Remediation - Execute autonomous actions through a deterministic guardrail mechanism
- Zero Interference - Ensure SLM workload never impacts standard system operations
┌─────────────────────────────────────────────────────────────────────┐
│ LINUX KERNEL STACK │
├─────────────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────────┐ |
│ │ Tracepoints │ │ eBPF │ │ k_slm_bridge Module │ |
│ │ (MCE, OOM) │──│ Programs │──│ (Ring Buffer Producer) │ |
│ └──────────────┘ └──────────────┘ └────────────┬─────────────┘ │
│ │ │
│ ┌────────────────────────────────────────────────▼───────────────┐ │
│ │ BPF_MAP_TYPE_RINGBUF (Zero-copy IPC) │ │
│ └────────────────────────────────────────────────┬───────────────┘ │
└───────────────────────────────────────────────────┼─────────────────┘
│
┌──────────────────────────────────────────────────▼─────────────────┐
│ USER SPACE │
├────────────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────────┐ │
│ │ slmd │ │ Guardrail │ │ SLM Inference │ │
│ │ Daemon │──│ Layer │──│ (llama.cpp / ONNX RT) │ │
│ └──────────────┘ └──────────────┘ └──────────────────────────┘ │
└────────────────────────────────────────────────────────────────────┘
| Component | Description | Location |
|---|---|---|
k_slm_bridge |
Kernel module for telemetry ingestion & IPC | kernel_module/ |
slm-ebpf-telemetry |
eBPF programs for tracepoint hooking | ebpf/ |
slmd |
User-space daemon for inference & remediation | daemon/ |
slm-guardrail |
Deterministic output validation layer | daemon/ |
slm_model |
Quantized SLM weights (INT4, <3B params) | models/ |
- Linux kernel 5.8+ (for BPF ringbuf support)
- clang >= 10.0 with BPF support
- Python 3.8+
- 4+ CPU cores for SLM isolation
- 4+ GB RAM for model
# 1. Build kernel modules
cd kernel_module
make KDIR=/lib/modules/$(uname -r)/build
sudo make KDIR=/lib/modules/$(uname -r)/build modules_install
# 2. Load kernel modules
sudo insmod k_slm_bridge.ko
sudo insmod k_slm_reserve.ko
# 3. Build eBPF programs
cd ../ebpf
make
sudo make load
# 4. Setup CPU isolation
sudo ../config/setup_slm_cpuset.sh --setup
# 5. Install Python dependencies
cd ../daemon
pip3 install -r requirements.txt
# 6. Run daemon
sudo python3 slmd.py --verbosesudo cp config/slmd.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable slmd
sudo systemctl start slmdThe SLM daemon requires dedicated CPU cores for inference. Configure with:
sudo ./config/setup_slm_cpuset.sh --setupDefault: CPU 8-15
SLM model weights must never be swapped. The daemon locks memory automatically:
ulimit -l unlimitedApply recommended sysctl settings:
sudo cp config/sysctl-safe.conf /etc/sysctl.d/99-slm-safe.conf
sudo sysctl --systemslmd.py [-h] [--model MODEL] [--device {cpu,cuda,metal}]
[--cpus CPU [CPU ...]] [--max-latency MAX_LATENCY]
[--dry-run] [--verbose]# Run with default settings (mock inference)
sudo python3 slmd.py --verbose
# Run with real model
sudo python3 slmd.py \
--model /var/lib/slm/models/phi-3-mini-q4.gguf \
--cpus 8 9 10 11 \
--verbose
# Dry run (simulate actions without executing)
sudo python3 slmd.py --dry-run --verbosecd tests
python3 -m pytest test_guardrail.py -v
python3 -m pytest test_ooda.py -v
python3 -m pytest test_integration.py -vpython3 test_integration.py| Document | Description |
|---|---|
| ARCHITECTURE.md | Detailed system architecture |
| QUICKSTART.md | Step-by-step setup guide |
| TROUBLESHOOTING.md | Common issues and solutions |
| Event | Type | Severity | Action |
|---|---|---|---|
| Machine Check Exception | MCE | CRITICAL | Log & alert |
| Out-of-Memory Kill | OOM_KILL | CRITICAL | Adjust memory settings |
| Hung Task | HUNG_TASK | WARNING | Monitor & log |
| I/O Error | IO_ERROR | ERROR | Log & alert |
| Hard Lockup | HARDLOCKUP | CRITICAL | Log & alert |
| Page Fault | PAGE_FAULT | INFO | Track patterns |
| CPU Stall | CPU_STALL | WARNING | Monitor & log |
| Action | Risk Level | Examples |
|---|---|---|
log |
SAFE | Log events for analysis |
sysctl |
MODERATE | Adjust vm.swappiness |
cgroup |
MODERATE | Modify cgroup settings |
restart |
RISKY | Restart services |
kill |
DANGEROUS | Terminate processes |
memory_offline |
DANGEROUS | Offline memory nodes |
All model-generated actions pass through a deterministic guardrail that:
- Validates action type against whitelist
- Checks targets against protected resources
- Enforces confidence thresholds
- Blocks injection attempts
- PIDs 0-2: Cannot be killed
- Critical services: Cannot be restarted
- System files: Cannot be modified
| Stage | Target | Maximum |
|---|---|---|
| Event capture | < 1 μs | 10 μs |
| IPC transfer | < 1 μs | 10 μs |
| Model inference | < 5 ms | 8 ms |
| Guardrail validation | < 1 ms | 2 ms |
| Total | < 10 ms | 20 ms |
| Resource | Requirement |
|---|---|
| CPU cores | 4 dedicated |
| RAM | 4 GB locked |
| NUMA node | 1 dedicated |
Copyright (c) 2026 SLM Kernel Team
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Contributions are welcome! Please see our contributing guidelines.
- GitHub Issues: https://github.com/slm-kernel/slmd/issues
- Documentation: https://docs.slmkernel.dev/
Last Updated: 2026-07-02