# 4GB swap allocated, but top reports 2GB



## mb2015 (Jul 23, 2018)

[Apologies if this is the wrong forum; I wasn't sure if it was specific to the BBB.]

On my BeagleBone Black rev. C, I am booting into FreeBSD 11.2-PRERELEASE on an SD card.

I have allocated the eMMC's Linux partition for encrypted swap, i.e. in /etc/fstab there is this:

```
/dev/mmcsd1s2.eli       none    swap    sw      0       0
```

I can confirm with `gpart list mmcsd1` that the partition is well over 2 GB:

```
2. Name: mmcsd1s2
   Mediasize: 3723493376 (3.5G)
```

`swapinfo` reports the full amount is allocated:

```
Device          1K-blocks     Used    Avail Capacity
/dev/mmcsd1s2.eli   3636224    25896  3610328     1%
```

Yet when I run `top`, it shows the swap space is exactly 2 GB (1971 MiB):

```
Swap: 1971M Total, 25M Used, 1945M Free, 1% Inuse
```

Why is `top` not saying something more like 3551 MB Total?


----------



## Phishfry (Jul 24, 2018)

I am using the eMMC for the OS and its defiantly 4GB on the BBB.

Have you cruised the FreeBSD mailing list. There have been some pertinent discussions about swap.
Basically gist is you can have too much swap. There was a discussion on freebsd-arm.
That was a discussion about interleaved swap(swap using several different devices) and it was acting weird(stalling).
I had never heard of interleaved swap but there was a lot of information in the thread about swap in general.
Sometimes the mailing-lists are hard to follow but there is some good info there. Spread over 2 months and a topic change.
https://lists.freebsd.org/pipermail/freebsd-arm/2018-June/017998.html
https://lists.freebsd.org/pipermail/freebsd-arm/2018-July/018167.html


> *Mark Millard*
> As I remember, the "increase kern.maxswzone" only applies if one has
> previously decreased it: the modern default is the maximum recommended
> as I remember (allowing for half the theoretical maximum swap). If
> ...




The discussions might have been on here too, but more in regards to swap oversize problems and ZFS.
In alot that I have read you can have too much swap.


----------



## mb2015 (Jul 25, 2018)

Thanks for pointing to that mailing list thread. Indeed, it is a challenging read. Apparently I'm not the only one whose system likes to sometimes lock up when swap is used. But the issue I am asking about is just that `top` is either misreporting the actual amount of swap, or maybe the system is really only using 2 GB. (Or maybe I'm misunderstanding what I am seeing.) The topic of this strange `top` output is not covered in the discussion.

If there is also a problem in that I have too much swap allocated, I don't mind reducing it; I've never seemed to need more than a few hundred MB. I just don't want to mess with `gpart` any more than I have to.


----------

