-
Hi.
I've discovered that swap space is "only" 32MB on my BQ E5 with OTA-5:
$ free -m total used free shared buff/cache available Mem: 951 705 44 1 201 214 Swap: 31 31 0 phablet@ubuntu-phablet:~$ cat /proc/swaps Filename Type Size Used Priority /userdata/SWAP.img file 32764 32504 -1
I feel pretty sure (thought I could be wrong) that swap was bigger, about 512MB, could that be the case that swap was reduced during OTA-4/5?
I have noticed that after OTA-5, unity, browser and other webapps crashes more often. I thought maybe I get out of memory errors more often, and so I discovered swap space being only 32M.
-
Phones/tablets do not have much (if any) swap enabled by default, because flash based storage has a limited number of writes in its lifetime, and using swap on such storage can greatly reduce the lifespan of the storage when apps get shoved into swap.
If you manually configured it to be larger previously, then that configuration very likely was replaced on update, especially if you were upgrading from 15.04, which would have resulted in a full image flash (so any modifications to rootfs would have been replaced).
-
I agree that swap can kill flash storage, but in current state, my phone is hardly usable.
I did experiment:
- Rebooted so that OS memory would be as clear as posible.
- ssh'ed into it and watched free -m output - it started with about (only!) 270MB avaialble memory
- Launched uNav, and kept scrolling as I if was driving.
- After some time, available memory got down to tenths of megabytes, and whole Untiy crashed!
I have these crashes when browsing with browser, or Reddit webapp, or similar. Just click on some link and boom - crash.
Swap HAS to be much bigger on such small memory devices as BQ E5...
I'll try to create bigger swap file and modify fstab to mount it...
-
Yep, no longer creashes. I see about ~180MB of swap spaces used up constantly, and uNav, Reddit webapp does not reproduce crash.
-
-
Hey,
Sorry for resurrecting a dead discussion, but its seems tobbe an issue for me too.What pazzles is does the size of the swap matter? I mean when the system run out of memory it will start swapping an writing to disk does it matter if its for a 32mb file or 1gib? I would think that the vm.swappiness kernel argument (which on the pinephone is on 60 ) will be more usefull here. Am i missing something?
BTW i'm askin this as im trying to improve pinephone performence and swapping and memory seems to be the biggest simple solution.
-
@darkeye zRAM should be used instead. Swapping to disk will incur a massive number of writes to the eMMC, thus reducing its useful life.
-
@dobey i understand the reason behind it but also a little puzzled as in this regard isnt 32mb is as bad as 1 gib? as the only thing we care about here is write operations (iops) and not the size stored on disk ( i'm sure that there will be some reduction with 32 mb as there will be less apps running in perellal but still... )
We can also reduce the swappiness tobhave a more prenunce effect with a limited swap size
In any case i've added zswap to my pinephone with 1GiB of swap abd reduced swappiness , i'll try and use it as a 'daily driver' ( as much as the pinephone can be... ) and report disk usage statistics in a few days.
-
@darkeye I don't know why specifically 32MB swap was used at all, instead of something a bit larger (beyond the fact that of course storage is limited on phones anyway).
All I can say is that the solution isn't "make a bigger swap partition/file" but instead to use zRAM and not use swap.
-
@dobey said in Swap space reduced?:
but instead to use zRAM and not use swap.
I still add extra 1GB swap file after every reboot, even with zRam available. BQ Aquaris E5 is barely usable with it's 1GB Ram otherwise. Try browsing uMastonauts and open found links in a browser - one of the app will be "blurred away".
But I guess it's an exception, and I will have to upgrade to newer and more powerful machine once E5 (Ubuntu 16.04?) will no longer be supported anyway.
-
Maybe we can add a swap creation tool to the UT- Tweaks app. this way the user can choose.
Also this way the user can also use the SD card as swap it will be slower but will solve the degradation issue (Which BTW on the current 1 days (none-) statistics i have seems to be kinda ok, will probably loose 1GiB of storage after 5 years on normal use as the average write operation is 0.68/s ). -
@darkeye Not all devices have external SD card support. And well, you immediately lose 1GB of storage by reserving it for swap, anyway.