I have a WearOS watch which is a frustratingly janky piece of crap. Whenever you try to do anything on it, it freezes for several seconds. Why? because it's SWAPPING! what the what?! 1.9G of virtual memory for a daemon on a wristwatch? 21 java apps, each with >760M vmem? JFC
Conversation
There's usually zram, not any actual swap on storage. It's still considered swap by the kernel. It's partly there to trigger kernel memory pressure mechanisms.
1
1
If there's actually real swap, that's insane. Android isn't designed to work with swap. It's supposed to run out of memory and trigger the userspace OOM killer implementation to kill inactive apps. It gets apps to save snapshots of state as soon as they become inactive.
1
Ahhh, so half the 1GB of RAM is partitioned into zram for swap? That makes a crazy sort of sense, but the performance is still awful.
1
You'd need to check to figure out how the device is set up.
Android devices do usually have a fair bit of zram. It has to be properly tuned for the device. It seems like this device may have way too much zram, and perhaps has it configured quite badly, especially for a weak CPU.
1
1
For example, here's the configuration for the Pixel 4:
android.googlesource.com/device/google/
It has 6GB of memory and sets 2GB as the max zram size.
It uses a backing file for zram writeback (512M) but that's *extremely* conservative and it has a fast SSD for it:
android.googlesource.com/device/google/
1
2
Older devices didn't use a backing store. It might not be intended for devices without a fast SSD. That's one potential issue.
source.android.com/devices/tech/p is a guide for OEMs setting up 512M memory devices and that's for the fully featured smartphone OS.
There are a lot of ways that an OEM could totally screw up the configuration of memory management. There's a lot more to it than zram configuration too. Just focused on that since it's why Android devices appear to have swap but they really shouldn't actually have swap.
1
On Pixels, the zram writeback job is done every 24 hours, meaning that it only actually flushes pages to storage (which is a fast SSD anyway) once per day that have been idle since the previous check a whole day earlier. First 2 runs after boot happen quicker (60 then 180 min).
1
Show replies


