Swap usage?

  • Has anyone else noticed Vivaldi using swap when it didn't before?
    Never used to use swap but now typically using 5-10 mb of swap when only 1/4 of ram utilized.
    Is this a change in chrome?

  • Moderator

    I have not. How did you find out Vivaldi is using Swap? In the meantime, I'll have a look on old & basic shell script.

  • I'm just assuming it's Vivaldi/chrome because that's the only application I have running... may not be.
    I monitor swap in my panel.
    Even though I have only 4gb of ram, swap was rarely used until recently.

  • Moderator

    Thanks for the shot. Ram available is 1.12G and using Swap (11M)

    My swapon output

    $ swapon -s
    Filename				Type		Size	Used	Priority
    /dev/sda5        	partition	8224764	0	-2

    I can not confirm.

  • I cleared swap but after a while started using swap again.

    swapon -s
    Filename				Type		Size	Used	Priority
    /dev/sdb4                              	partition	5303292	1548	-2

    Using a command found here to show processes using swap, it appears to be Xorg using Swap.
    I'll look into it.
    Thanks for checking.

  • Moderator

    @CantankRus You are welcome.
    Have you tried the temp install to check if your profile folder?

    I found the script to show the usage of Ram / Cpu, it's a mess. two command is enough for now
    $ ps -eo pid,comm,pmem,etime | grep vivaldi | awk '{ print $1, $2, $3, $4 }' > temp1 ## display all processes

    $ awk '{ printf "%-8s%-17s%-8s%-2s \n", $1, $2, $3, $4 } { sum+=$3 } END { print "\n" "Total RAM Used: "sum " MB" }' temp1 > temp2


    7361    vivaldi-sandbox  0.0     25:01 
    7362    vivaldi-bin      0.6     25:01 
    7364    vivaldi-bin      0.1     25:01 
    7387    vivaldi-bin      1.3     25:01 
    7390    vivaldi-bin      1.0     25:01 
    7402    vivaldi-bin      0.1     25:01 
    7410    vivaldi-bin      1.0     25:01 
    7424    vivaldi-bin      3.5     25:01 
    7441    vivaldi-bin      1.3     25:01 
    7456    vivaldi-bin      1.0     25:01 
    7793    vivaldi-bin      0.9     24:31 
    7819    vivaldi-bin      0.9     24:31 
    8273    vivaldi-bin      1.0     23:52 
    8279    vivaldi-bin      1.9     23:52 
    10615   vivaldi-bin      1.2     18:05 
    10624   vivaldi-bin      1.2     18:05 
    12006   vivaldi-bin      0.6     14:31 
    Total RAM Used: 20.7 MB

  • So, the swap space is not just extra memory for when you use up your physical RAM. Vivaldi & Chrome do not manage when their memory usage gets moved to swap either, this is controlled by Linux. What Linux will do is move pages in memory to swap that it thinks are highly unlikely to be needed any time soon. This frees up the faster physical RAM to be used as buffer cache -- that is, to cache files & metadata from disk for faster access. When programs start there is some days stored in memory that is used for initialization only, and it will never be used again. This kind of data is best moved out of RAM and into swap, providing more RAM for buffer cache.

    If you're certain that the swap space being used is by Vivaldi, and your certain that it has increased, there are a couple possible explanations. One is that there is a little bit more of the memory used at startup being identified as unlikely to be used again anytime soon, quite possibly extra initialization data from either the browser itself or perhaps an extension. Another possibility is that the swapiness value in the OS has increased, which makes Linux more aggressively move things to swap.

    Basically, this is nothing to worry about unless you're noticing thrashing. But, based on the really low numbers you've posted, I doubt that's happening. You could try modifying the swapiness setting to make Linux less aggressive, but these settings have been tuned over the years for a reasonable amount of swapping (technically paging) for the typical use of the system. It's unlikely that you're going to improve your system performance without doing a lot more investigation to both understand how Linux manages swap, what exactly is happening on your system, and how that differs from the ideal if it does.

    Have you run SAR to look at the system activity data? That would be a first step to identifying what's actually occurring here. But really, I just wouldn't worry about it. Linux is managing your memory for you to increase the efficient use of RAM.

  • @bonetone
    I have used a swappiness of 10 for many years and swap was rarely used.
    It appears to be Xorg and systemd processes, not Vivaldi using swap.

    $ cat /proc/sys/vm/swappiness

    Everything running fine except I get occasional mouse stalls for about a second and was curious
    if it was related to increased swap usage.
    I will look at SAR.

  • Moderator


    It's the OS, not Vivaldi specifically. Debian 10 left Xorg.
    Vivaldi not running : Swap 20% (65.8M)

    $ !1836
    swapon -s
    Filename				Type		Size	Used	Priority
    /dev/sda5                              	partition	8224764	67584	-2 

  • @CantankRus said in Swap usage??:

    I have used a swappiness of 10 for many years and swap was rarely used.

    10 is really low, the default is 60. I'm just curious why you set it so low. Are you running with a very large amount of RAM? Even then I've read that swap in Linux is still desirable, but I'm not certain I buy into that. On one workstation I've got so much RAM I didn't even bother creating any swap space, so it's basically like setting swapiness to 0, but without the wasted storage a swap partition would take. I do need to read a bit deeper before accepting the oft repeated claims about using swap in Linux, so I am interested what your reasons are for decreasing the swapiness that much.

    ModEdit: removed the |off topic|

  • @bonetone
    It's not something I know a lot about.
    It's a common tweak for a Linux desktop...whether it's worth while or not I wouldn't know.

    From the ubuntu swap FAQ

    The default setting in Ubuntu is swappiness=60. Reducing the default value of swappiness will probably improve overall performance for a typical Ubuntu desktop installation. A value of swappiness=10 is recommended, but feel free to experiment. Note: Ubuntu server installations have different performance requirements to desktop systems, and the default value of 60 is likely more suitable.

    I boot up to less than 500mb mem used, and rarely use more than 2gb.
    It's only recently numerous processes have started using swap.
    Not to say it's a bad thing... just curious as to why swap is now being used so often.
    Seems to be ignoring my swappiness setting.

  • @lamarca
    What's your swappiness value?

    $ sysctl vm.swappiness
    vm.swappiness = 10

  • Moderator


     sysctl vm.swappiness
    vm.swappiness = 60

    I forgot to mention the Ram available was less than 250mb on the swapon cmd.

  • Moderator

    @bonetone Hello there,

    Your posts are not <off>, that's why I edited the post.
    Thank you for taking your time to write relevant information.

  • Moderator

    Resolved. Thread locked.

Log in to reply

Looks like your connection to Vivaldi Forum was lost, please wait while we try to reconnect.