Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions board/common/rootfs/etc/sysctl.d/vm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Memory and OOM tuning for embedded network devices
# Optimized for systems with 512MB-4GB RAM
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description states the configuration is "optimized for embedded network devices 512MB-8GB of memory" but this file states "512MB-4GB RAM". This inconsistency should be resolved. Based on the documentation file which also mentions "512MB-4GB RAM" and provides separate guidance for "4GB+ Memory", the configuration file appears correct and the PR description may need updating.

Copilot uses AI. Check for mistakes.
# Target: Fast and deterministic OOM behavior

# OOM Behavior
# Panic on OOM for fast system reset and recovery
vm.panic_on_oom=1
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting vm.panic_on_oom=1 will cause a kernel panic on OOM, but without also setting kernel.panic to a non-zero value (e.g., kernel.panic=10), the system will hang at the panic screen rather than automatically rebooting. For "fast system reset and recovery" as stated in the comments and PR description, consider adding kernel.panic=10 (or similar value) to enable automatic reboot after a panic. This would complete the "deterministic recovery" behavior.

Suggested change
vm.panic_on_oom=1
vm.panic_on_oom=1
# Automatically reboot 10 seconds after a kernel panic for deterministic recovery
kernel.panic=10

Copilot uses AI. Check for mistakes.

# Dirty Page Writeback
# Limit dirty pages to 10% of RAM before blocking writers
# Start background writeback at 5% to prevent accumulation
vm.dirty_ratio=10
vm.dirty_background_ratio=5

# Writeback Timing
# Expire dirty pages after 10 seconds (1000 centiseconds)
# Ensures quick flushing on limited-memory systems
vm.dirty_expire_centisecs=1000

# Memory Watermarks
# Increase distance between low/high watermarks for earlier reclaim
# Maintains larger free memory buffer proactively (default: 10)
vm.watermark_scale_factor=150
2 changes: 2 additions & 0 deletions doc/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ All notable changes to the project are documented in this file.
production environments. See the documentation for usage examples
- Add support for "routing interfaces", issue #647. Lists interfaces with IP
forwarding. Inspect from CLI using `show interface`, look for `⇅` flag
- Add memory tuning configuration for embedded network devices with aggressive
dirty page writeback and OOM panic for deterministic recovery

### Fixes

Expand Down
32 changes: 32 additions & 0 deletions doc/system-tuning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# System Tuning Guide

## Memory

Default memory tuning is defined in `/etc/sysctl.d/vm.conf`, optimized for embedded network devices with 512MB-4GB RAM.
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description states the configuration is "optimized for embedded network devices 512MB-8GB of memory" but this documentation states "512MB-4GB RAM". This inconsistency should be resolved. Based on the configuration file comments and the fact that this documentation provides separate guidance for "4GB+ Memory", the documentation appears correct and the PR description may need updating.

Copilot uses AI. Check for mistakes.

### For Systems with 4GB+ Memory

Systems with more memory can afford to be less aggressive with cache reclaim.

```conf
# Allow more dirty pages before writeback
vm.dirty_ratio=15
vm.dirty_background_ratio=10

# Less aggressive watermark (memory pressure less critical)
vm.watermark_scale_factor=100
```

### For Systems with Heavy Filesystem Activity

Unusual for network equipment, but may occur on systems with extensive logging or storage features.

```conf
# Allow more dirty pages for better write batching
vm.dirty_ratio=20
vm.dirty_background_ratio=10

# Longer dirty page expiration for write coalescing
vm.dirty_expire_centisecs=3000
```

1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ nav:
- Developing with Buildroot: override-package.md
- Netboot HowTo: netboot.md
- Regression Testing: testing.md
- System Tuning Guide: system-tuning.md
- Test System Architecture: test-arch.md
- Virtual Environments: virtual.md
- Vital Product Data (VPD): vpd.md
Expand Down