We have moved to a new Sailfish OS Forum. Please start new discussions there.
12

How to change zram size ?

asked 2015-01-18 22:55:29 +0200

Mądry gravatar image

updated 2015-01-19 15:47:10 +0200

I would like to change the default size of zram from those 13%. Since u8 I've been happily using 25% of ram as compressed block device and now I'w like to try this setting on latest update which seems to be less memory demanding. And here comes the question: how to do it since configuration seems to be moved from zramcfg to systemd and there is no zram.service in /etc/systemd/system/ folder ?

Edit: As user #g7 mentioned, to change the default size of zram, /usr/sbin/zramswapon config file has to be edited. In the middle of the text you should see this: SIZE=$(( $MEMORY_IN_KBYTES * 1024 * 13 / 100 / NUM_ZRAM_DEV )) where value 13 represents percantage of physical ram assigned to zram. Change it to 30 so 830*30/100=249 MB of ram will be used as compressed ram (much faster swap than traditional partition on emmc).

edit retag flag offensive close delete

2 Answers

Sort by » oldest newest most voted
1

answered 2015-01-19 10:01:42 +0200

g7 gravatar image

updated 2015-01-19 10:02:38 +0200

You must edit /usr/sbin/zramswapon.

It won't be a bad idea to port zramcfg to u10 though, but that means to mess up with Jolla's implementation.

edit flag offensive delete publish link more

Comments

Thanks for an answer. I've managed to edit the file and change the default 13% size of zram to 30% without a problem. So far I didn't encounter any side issues but even a notable improvement in overall usability of my Jolla. Worth mentioning is that I have also changed the swappiness value from default 30 to 60 so there is more free physical ram available for heavy applications and oom condition is less often triggered. Also with swappiness 60 old pages seem to be more often flushed(?) or freed from zram so the situation when all compressed ram is full gets less probable. It seems to me that further playing with vm, oom_killer configuration might bring us significant multitasking improvement and even solve the ultimate “multitasking regression„ that u10 brought to some users ;)

Mądry ( 2015-01-19 15:25:05 +0200 )edit

So how to actually apply the new setting? For me it seems that the /sys/block/zram0/disksize doesn't change from the default value even if I edit the config file.

synthent ( 2015-01-20 21:39:40 +0200 )edit
0

answered 2015-02-15 12:17:18 +0200

ropelius gravatar image

how u can edit that zram file? In terminal using what code or some program? i dont get it work in any kind of ways..

edit flag offensive delete publish link more

Comments

I used tinyedit from openrepos with root privileges (another package called tiny root must be installed also from openrepos) to edit the config file. It can be done via command line too with vi editor which if I recall correctly is installed by default so the only thing you need to do is gain developer access in terminal and paste this:

vi /usr/sbin/zramswapon

Then change the 13 value in SIZE=$(( $MEMORY_IN_KBYTES * 1024 * 13 / 100 / NUM_ZRAM_DEV )) for number you want and save it by tapping shift(?) character twice (so you can enter big letters) and typing ZZ (two capital letters). This should save your changes to the file and quit the editor.

Mądry ( 2015-02-15 14:36:02 +0200 )edit

@ropelius please repost as comment since you asked a question instead of an answer.

DarkTuring ( 2016-12-15 18:23:04 +0200 )edit
Login/Signup to Answer

Question tools

Follow
6 followers

Stats

Asked: 2015-01-18 22:55:29 +0200

Seen: 4,157 times

Last updated: Feb 15 '15