Skip to content

omamobile.config: swap on zram, and the 9a's zram notes - #515

Merged
derekross merged 1 commit into
derekross:mainfrom
den-kloot:omamobile-config-zram
Nov 8, 2026
Merged

derekross merged 1 commit into
derekross:mainfrom
den-kloot:omamobile-config-zram

Conversation

@den-kloot

Copy link
Copy Markdown
Contributor

What and why

Swap on zram for every phone: build the zram driver (CONFIG_ZRAM=m, zstd as the default, lz4 available) in kernel/configs/omamobile.config, and record the Pixel 9a's test in device/tegu/NOTES.md.

Our kernel has no zram driver, so a phone has no swap at all. Omarchy configures swap on zram on every aarch64 machine (in Omarchy v4.5.0: zram-generator in install/omarchy-aarch64.packages, default/systemd/zram-generator.conf.d/90-omarchy.conf, and the vm.* reclaim tuning in etc/sysctl.d/99-omarchy-sysctl.conf), and stock Android runs one on the 9a (half the RAM). Once the image moves past Omarchy 4.0.6, that config arrives by itself, and without the driver it finds no device.

On the 9a (7.4 GB) a cargo build next to Brave and the shell left 177 MB available, stalled the session (memory PSI full about 50 %, SSH timing out) and ended at the OOM killer, which took the terminal's app scope with it.

Nothing changes at boot until something configures a zram device: the modules load only on demand. No package changes. Issues and PRs have nothing on swap or zram yet.

What I measured

The details are in device/tegu/NOTES.md, under 2026-11-08.

  • Half the RAM as zram (3.6 GB, Omarchy's zstd and tuning, zram-size = ram / 2): I allocated 5 GB more on top of about 4 GB in use.
    • No OOM kill, and SSH answered throughout.
    • PSI full peaked at 32 % and dropped below 10 %.
    • zram held 3.2 GB in 1.7 GB.
  • Omarchy's RAM-sized zram (zram-size = ram, 7.3 GB): I allocated 6 GB more.
    • The phone stopped answering, and came back after a restart.
    • No OOM kill and no oops in the journal. Its last lines are the CP's PCIe link going down and brcmfmac failing to allocate RX buffers.
    • It is not a like-for-like comparison (5 GB against 6 GB). Still, a RAM-sized zram looks like a risky default on these phones.
  • Stock Android on the 9a uses zramsize=50% plus a 1 GB writeback file (vendor.zram.size=50p → fstab.zram.50p), and no swap partition.

When the image picks up Omarchy's zram config, it may want a drop-in that caps it at ram / 2. That is for a later PR, and the maintainer's call.

How to try it by hand

On a kernel built with this fragment:

sudo pacman -S zram-generator
sudo tee /etc/systemd/zram-generator.conf >/dev/null <<'CONF'
[zram0]
zram-size = ram / 2
compression-algorithm = zstd
swap-priority = 100
CONF
sudo systemctl daemon-reload
sudo systemctl start systemd-zram-setup@zram0.service
zramctl; swapon --show

Resize only while zram is empty. Stopping the unit removes /dev/zram0, and cat /sys/class/zram-control/hot_add brings it back.

Device and build

  • Phone: Pixel 9a (tegu)
  • Kernel release (uname -r): 7.3.0-rc6-omamobile-push1-ge8d722982099, a local build.
    • The options were set in the device's kernel.config for the test.
    • They build only modules: zram.ko and zsmalloc.ko went onto the running release with bin/omamobile modules-push, without a new boot image.
    • zram came up again by itself at the next boots.
  • Packages changed, with versions: none.

Checks (no phone needed)

  • tools/pr-check origin/main passes
  • tests/all passes
  • tests/packages: no package touched
  • Each changed package has its version bumped: no package changed
  • Commits have area prefixes and bodies that say why; AI help is a Co-Authored-By: trailer, no AI Signed-off-by:

On the phone

  • I ran this on my own phone, booted into this build: zram up at boot, the two load tests above.
  • What I did not test:
    • a fresh image build with the fragment;
    • any other phone;
    • lz4;
    • ram / 2 with the same 6 GB load that hung ram.
  • Nothing in this change writes outside slot B and userdata, weakens the storage guard, or reads registers from userspace.

The not ok rows below were there before this change:

tools/phone-smoke report
Check Result Detail
boot (required) ok kernel 7.3.0-rc6-omamobile-push1-ge8d722982099, slot b, up 2204s
storage guard (required) ok 62 partitions; only userdata and slot B's boot images writable
root (required) ok ext4 on userdata, 92G free
kernel health (required) ok no oops or BUG; 0 WARN, 15 error lines in dmesg (8 known, 7 new)
new dmesg errors not ok N N: brcmf_vif_set_mgmt_ie: vndr ie set error : N x2; N N: N: scan error (N) x2; cpif: rx_demux: PCIE: ERR! N is not opened x1
systemd units not ok failed: systemd-backlight@backlight:19440000.dsi.0.service
USB gadget (required) ok bound to 11210000.usb
display ok card1-DSI-1 connected, 1080x2424
GPU ok render node on panthor
session (required) ok Hyprland and the Omarchy shell running
lock ok PAM file present, the shell can lock (passwordPam true, locked false)
touch ok Synaptics TouchComm Touchscreen
buttons ok gpio-keys
Wi-Fi ok wlp1s0 on brcmfmac, link up
Bluetooth ok hci0, powered true
battery ok 75% Discharging, 28 °C
sound cards ok googleteguaocsn
sensors ok Accelerometer AmbientLight Proximity
cameras skip no libcamera tools
thermal ok hottest zone 42 °C

🤖 Generated with Claude Code

https://claude.ai/code/session_01176vSgL9PRmxFqbaB3D9vk

Build the zram driver as a module, with zstd (Omarchy's algorithm) as
the default and lz4 available. Omarchy's settings configure swap on
zram on every aarch64 machine (zram-generator, 90-omarchy.conf and the
vm.* tuning in 99-omarchy-sysctl.conf), and stock Android runs one on
the Pixel 9a (half the RAM), but our kernel has no driver, so a phone
has no swap at all. On the 9a (7.4 GB) a cargo build next to Brave and
the shell left 177 MB, stalled the session for minutes and ended at the
OOM killer, which took the terminal's app scope with it.

device/tegu/NOTES.md records the test: with half the RAM as zram, 5 GB
more allocated ran without an OOM kill and with SSH answering; with
Omarchy's RAM-sized zram, 6 GB more allocated hung the phone until a
restart. Stock Android's own setting on the 9a, and how to set it up by
hand until the image ships zram-generator, are there too.

Nothing changes at boot until something configures a zram device: the
modules load only on demand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01176vSgL9PRmxFqbaB3D9vk
@derekross

Copy link
Copy Markdown
Owner

Thanks for this, and for the careful notes: the before and after, stock's
own setting, and the NV check after the hang are all exactly what I'd want
in the record. Testing both sizes, and saying plainly that the two runs
weren't like for like, makes the case for a cap well.

I built the kernel config with main's fragment and with yours, the way
bin/omamobile kernel merges it: the only difference is the zram block and
ZSMALLOC=m, nothing built in changes, and every symbol exists on
omamobile. I also checked the pinned Omarchy 4.0.6: it ships no zram
config and our image doesn't install zram-generator, so nothing creates a
device and the module never loads today, on any phone. CI is green.

You're right that the cap matters. I looked at Omarchy 4.5.0, and its drop-in
is zram-size = ram, with zram-generator in its aarch64 package list. So once
this driver is in, moving the image past 4.0.6 would switch on the setting
that hung your 9a. I've opened #528 so the 4.5 move ships a drop-in that
caps it at half the RAM, as stock does, and treat it as a condition of that
move. Nothing to change here for that, so I'm merging this now.

One small question for the notes, not blocking: after the 6 GB run, did the
phone come back through a watchdog reset or did you hold the buttons? If it
was the buttons, I'd like the notes to say so, since that's what a RAM-sized
default would mean for everyone.

Your autofocus PR (#494) also adds a section at the top of the 9a notes;
I'll resolve that when it merges, newest first.

@derekross
derekross merged commit e738021 into derekross:main Nov 8, 2026
2 checks passed
@den-kloot

Copy link
Copy Markdown
Contributor Author

On the 6 GB run: not recorded, I'm afraid. The phone stopped answering at 09:56 and the next boot was at 10:02; there was no runtime watchdog then (RuntimeWatchdogSec off, only RebootWatchdogSec=1min), the 9a's kernel config has no lockup or hung-task detectors, so a hang like this leaves no panic and no pstore record, and the day had too many restarts to say from memory whether that one was the buttons. The six-minute gap points to a held power key rather than a reset, but I won't put that in the notes as fact. Since then the phone runs with RuntimeWatchdogSec=30s (the s3c2410 watchdog), so the next hang of this kind will show as a watchdog reset.

robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
Build the zram driver as a module, with zstd (Omarchy's algorithm) as
the default and lz4 available. Omarchy's settings configure swap on
zram on every aarch64 machine (zram-generator, 90-omarchy.conf and the
vm.* tuning in 99-omarchy-sysctl.conf), and stock Android runs one on
the Pixel 9a (half the RAM), but our kernel has no driver, so a phone
has no swap at all. On the 9a (7.4 GB) a cargo build next to Brave and
the shell left 177 MB, stalled the session for minutes and ended at the
OOM killer, which took the terminal's app scope with it.

device/tegu/NOTES.md records the test: with half the RAM as zram, 5 GB
more allocated ran without an OOM kill and with SSH answering; with
Omarchy's RAM-sized zram, 6 GB more allocated hung the phone until a
restart. Stock Android's own setting on the 9a, and how to set it up by
hand until the image ships zram-generator, are there too.

Nothing changes at boot until something configures a zram device: the
modules load only on demand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants