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
# Target: Fast and deterministic OOM behavior

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

# 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.

### 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