[zswap] Ubuntu 22.04 full Raspberry Pi 4 support on 2GB RAM

Apr 24, 2022 Last reply: 4 years ago 3 Replies

formatting link
Ubuntu Linux 22.04 arrives with new desktop features and full Raspberry Pi 4 support



Ubuntu 22.04 is the first release that works on all Raspberry Pi 4 models when using the full desktop environment, which Raspberry Pi revealed earlier this year.



formatting link
Linux 22.04 will be faster than ever on Raspberry Pi computers



Oliver Smith, a Product Manager at Canonical, announced in a blog post that the next release of Ubuntu Desktop will have new performance enhancements for Raspberry Pi boards.



The main change is that Ubuntu on the Raspberry Pi will use the Linux kernel's zswap feature by default, which compresses blocks of memory instead of completely relying on a swap file (where RAM contents are moved in and out of a swap area in the internal storage). This decreases the amount of I/O operations that can occur, which is important when most Raspberry Pi owners use simple SD cards as the main drive. However, memory compression also increases CPU usage, which is presumably why this won't be enabled on older Raspberry Pi boards with less powerful CPUs.



formatting link
Ubuntu Desktop on a 2GB Raspberry Pi 4



However the full desktop environment is quite a lot for the Pi to handle. Up until now, we've recommended users stick to models with either 4GB or 8GB of RAM to be confident that it will perform well. One of our goals for the upcoming Ubuntu 22.04 LTS release is to lower that barrier to entry. This means targeting a viable Desktop experience on Raspberry Pi 4 2GB models.



The secret to this optimisation is a Linux kernel feature called zswap.


On a sunny day (Sun, 24 Apr 2022 16:23:35 -0000 (UTC)) it happened NewsKrawler snipped-for-privacy@krawl.org wrote in <t43ti6$3i5rb$ snipped-for-privacy@paganini.bofh.team>:

Not sure it make much difference, my Oi4 4GB does not use any swap raspi95: /mnt/sda2/security/video # vmstat procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 0 2429192 7164 1098336 0 0 0 5 3 3 10 4 85 1 0

it runs 6 security cameras, and chromium occasionally it also records other data 24/ radiation. air traffic, wether data etc. raspi95: /mnt/sda2/security/video # uptime 18:30:23 up 21 days, 10:40, 15 users, load average: 0.27, 0.72, 0.87

in alu housing with fan: raspi95: /mnt/sda2/security/video # temperature temp=45.0'C

Maybe no swap because I limit cache in crontab like this: # clear cache every 15 minutes to prevent swap space usage and swap partition overflow due to too little free memory left

0,15,30,45 * * * * /bin/echo 3 > /proc/sys/vm/drop_caches

what does Ubuntu have that raspian does not have?

I also have a Pi4 8GB mostly used for Chromium web browsing an coding applications. raspi99: ~ # vmstat procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 1024 3463372 163740 4163576 0 0 2 0 3 5 7 3 89 1 0

Here swap is used as I do not do the cache limiting thing.

raspi99: ~ # uptime 18:39:44 up 21 days, 4:24, 11 users, load average: 0.89, 1.09, 1.25

raspi99: ~ # temperature temp=68.6'C original plastic housing, also runs pimoroni FLIR stuff.

Nothing much, unless you've already standardised on Ubuntu on other platforms.

I found the older Pi's with 1GB which could really benefit from zram are too slow (including the 3B+) and the Pi 4B which is fast enough doesn't really need it if it has 4GB or more of memory, so that leaves the 2GB Pi 4B which has enough CPU but not enough RAM - the one variant I don't have. Although other people's usage patterns may make a difference.

---druck

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required