# 9.3 to 10.2 increases swap usage



## YuryG (Aug 27, 2015)

I have 16GiB of RAM on amd64 architecture. And my main usage for system is desktop, no huge web server or something.

When I was on 9.3, swap was used not more that 6M. But after upgrade to 10.2 it is almost always is used by 500M–900M. I'm not sure, is it some occurred user-side software "feature" or change in kernel memory strategies? And is there anything to worry about?


----------



## SirDice (Aug 27, 2015)

Swap usage in and of itself isn't a problem. It's excessive swapping that causes performance problems. What else is the machine running?


----------



## YuryG (Aug 27, 2015)

SirDice said:


> Swap usage in and of itself isn't a problem. It's excessive swapping that causes performance problems. What else is the machine running?


Browser(s) (mainly www/firefox), torrent client (net-p2p/transmission), from time to time audio software (audio/audacity), 6 console windows with misc/mc etc.
That's what I have now in `top`:

```
Mem: 1098M Active, 12G Inact, 1808M Wired, 145M Cache, 1626M Buf, 660M Free
Swap: 6144M Total, 542M Used, 5601M Free, 8% Inuse
```


----------



## SirDice (Aug 27, 2015)

That's not too bad. Here's mine:

```
Mem: 401M Active, 320M Inact, 6998M Wired, 580M Buf, 111M Free
ARC: 3220M Total, 1033M MFU, 1512M MRU, 832K Anon, 73M Header, 601M Other
Swap: 16G Total, 690M Used, 15G Free, 4% Inuse, 52K In
```
Keep in eye on the "in/out" values of the swap. That will tell you if there's swapping happening or not. Yours looks fairly static (nothing in or out) so I wouldn't worry too much about it.


----------



## hanzer (Sep 3, 2015)

My little [FONT=Courier New]10.2-RELEASE-p2 #0 r287337 i386[/FONT] machine doesn't seem to touch swap even when pressed.

```
CPU: 87.0% user,  0.0% nice, 11.0% system,  2.0% interrupt,  0.0% idle
Mem: 36M Active, 696M Inact, 104M Wired, 9340K Cache, 79M Buf, 14M Free
Swap: 3852M Total, 3852M Free
```


----------



## max21 (Sep 17, 2015)

My guest is this could have happened elsewhere, such as installation of something. I'm going to install a 10.2 mate desktop soon, so I'll be on the look-out.  Try this:


```
# swapoff -a #  will empty swap
# swapon -a  #  swap is now clean
```
Check if it change in top, than reboot and see if it comes back.


----------



## YuryG (Sep 17, 2015)

Well, it constantly grows from 400M to 950M forth and back, during compilation of ports or browser usage. And after reboot it's 0.


----------



## max21 (Sep 18, 2015)

I’m still a noob, all I know is protecting dual-boot-desktop stuff, but I read a thread recently here that could be a work-around until it get fixed (if threads like this are taken into account).  For what I read, there is no reason that swap should touch when you got plenty of memory.  This tells me it could be a installed application causing it, or maybe faulty ACPI on the motherboard.  I would take it from the top on another machine. Try this just to see if it works:

In sysctl.conf: Tell the kernel to use cache instead of swap.

```
vm.defer_swapspace_pageouts=1
```


----------

