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

[Question] Any way to reduce swap usage after long uptime?

asked 2015-03-09 03:07:06 +0300

droll gravatar image

updated 2015-03-09 16:51:57 +0300

objectifnul gravatar image

Using sysmon from openrepos, I always see an upward trend in swap usage starting from a reboot. This is normal as processes / daemons / etc startup immediately after reboot. However, I still see the upward trend for the next 48 hours. Swap usage increases until around the 48 hour mark when it hits an average peak of around 300Mb. And then it goes through peaks and troughs but has an almost flat trending line (unless I do something major like stop the Dalvik service).

RAM usage, oth, has a pretty stable usage trend (with peaks and troughs) over the same time period.

Is there a way I can flush the swap or at least see what's using it? To be fair, I do use the phone quite a bit and I use web browsing quite a bit (using a combination of browsers - Opera + Sailfish browser), plus some android apps occasionally.

edit retag flag offensive close delete

Comments

After around 30 Days uptime my phone does not react on any touch input except swiping to minimize. Maybe this behaviour is coming from the swap usage, just as a consequence for completeness

NuklearFart ( 2015-03-09 11:30:06 +0300 )edit
2

If it peaks and then levels, that is not a bad thing. Swap is a problem only if it is ontinuously moving out pages that are needed again immediately. Long-running applications may get pages swapped out, that are not needed for a long perod of time (or ever) so it is good these are swapped out. Most programs for example touch very different parts on memory on startup compared to normal operation. So eventually, the least recently used pages get out of main memory, and that means more memory for applications that actually needs it. Are you just curious, or is there some performance problem you are tracking down?

mikelima ( 2015-03-09 13:52:19 +0300 )edit

I was trying to track down possible sources as to why the phone jitters (quite a bit more vs the previous OS update) and if there is a way to reduce or eliminate the jitters.

droll ( 2015-03-09 14:35:34 +0300 )edit
1

you may try to use

vmstat 1

in a terminal window and check what happens.when you do different operations. the "si" and "so" values indicate the swap in and swap out events. "swap in" event happens also when you load a new program, but "swap out" event means the memory was full and something needed to be moved out of main memory. Tweaking the user interface to be responsive may be a challenge. Developers can try to use "mlock" to lock performance critical sections of a program to RAM, but it is kind of a black magic...

mikelima ( 2015-03-09 16:52:17 +0300 )edit

Thank you. This works well too. In the end there may be nothing much I can do to reduce jitter :( But I'll do my investigation and see what I find.

droll ( 2015-03-10 02:02:41 +0300 )edit

2 Answers

Sort by » oldest newest most voted
6

answered 2015-03-09 12:38:57 +0300

tigeli gravatar image

You can see swap usage either by using "smem" which is not available out of the box but this should also help:

for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | less
edit flag offensive delete publish link more

Comments

i will try this. thanks.

btw, I tried swapoff on the mmcblk swap device and then swapon again. it did reduce swap usage by quite a bit.

droll ( 2015-03-09 14:34:25 +0300 )edit

Found this command somewhere on the internet some time ago to check what uses the most of the swap space. It's very useful and gives easier to read output than smen ( at least for me. I didn't dive into smem manual that much ). Intereating discovery was when I found out that long time ago closed android apps (by swype down) data wasn't flushed out from swap. If I close it by either android back button or hold it and click X they no longer show up on the output list of this command. So here's the question: Is closing by swype down somehow different than by those two methods mentioned above ?

Mądry ( 2015-03-09 18:21:41 +0300 )edit
0

answered 2015-03-09 15:17:26 +0300

Lightning gravatar image

I have the same problem. Try to stop alien dalvik. In my case the swap were reduced for 500 MB after that. But I think that RAM monitoring is needed for every application during long time. Some applications (maybe system) can give memory leaks.

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2015-03-09 03:07:06 +0300

Seen: 621 times

Last updated: Mar 09 '15