increase kern.maxswzone or reduce amount of swap.

Hi, I am new with FreeBSD. Can someone please tell me what this means?

dmesg:
Code:
warning: total configured swap (16777216 pages) exceeds maximum recommended amount (16129800 pages).
warning: increase kern.maxswzone or reduce amount of swap.
Code:
# freebsd-version
13.1-RELEASE-p7

# sysctl kern.maxswzone
kern.maxswzone: 0

top
last pid: 95048;  load averages:  0.60,  0.65,  0.67 up 0+00:39:31  11:30:38
105 processes: 1 running, 104 sleeping
CPU:  2.4% user,  0.0% nice,  0.4% system,  0.0% interrupt, 97.2% idle
Mem: 794M Active, 411M Inact, 1446M Wired, 40K Buf, 13G Free
ARC: 595M Total, 92M MFU, 485M MRU, 8069K Anon, 3746K Header, 7354K Other
     518M Compressed, 1526M Uncompressed, 2.95:1 Ratio
Swap: 64G Total, 64G Free
 
How much memory does the machine have? Looks like 16GB? Why do you have 4 times as much swap? Why do you think you need that much?

Anyway, just boot to single user mode, remove the current swap partition and create a new smaller swap partition. With 16GB of memory I wouldn't use any more than around 8GB of swap. Unless you have some specific reason for a lot more?
 
How much memory does the machine have? Looks like 16GB? Why do you have 4 times as much swap? Why do you think you need that much?
Yes there is 16GB mem. There is no specific reason for big swap space. Is that problem?
 
There is no specific reason for big swap space. Is that problem?
Yes, it's severe overkill. The old rule of thumb is to have 1.5-2 times the amount of memory. But that was when we still measured memory in megabytes. Nowadays you rarely need any more than 8GB.

Like I said, just boot to single user mode and remove/recreate the freebsd-swap partition.
 
Concerning the message itself: it is about fragmentation. Swap can receive data chunks of differing size, so when used it will fragment over time. Anyway an index table in memory is needed to keep track of what has gone into swap. And the memory for that table must be reserved beforehand, and it must be of appropriate size.
I once tried to figure out how that maxswzone would be correctly sized, but with no success. And nowadays it is 0 by default.
I think for a rarely used swap the message could be ignored. In any case, swap fragmentation can be monitored via sysctl vm.swap_fragmentation
 
I have a swap partition only slightly bigger then the amount of system memory (32G). It is that big because if the kernel kpanics again, I'd like it to be able to kdump into swap and save a core on next boot for examination. In order to ensure this can always happen that swap partition needs to be big enough to fit all of memory. Is this wrong, or perhaps a better way to do this that would make the warning go away?
warning: total configured swap (70903381 pages) exceeds maximum recommended amount (32636368 pages).
 
we have an 8-way raidz3 pool with 128-gig "swap" partitions on each drive for our machine with 64 gigs of RAM. here's our setup:
Code:
# gmirror status
         Name    Status  Components
mirror/swap.a  COMPLETE  da1p1 (ACTIVE)
                         da2p1 (ACTIVE)
                         da0p1 (ACTIVE)
                         da3p1 (ACTIVE)
# grep mirror /etc/fstab
/dev/mirror/swap.a.eli none swap sw 0 0
# grep dumpdev /etc/rc.conf
dumpdev="gpt/dump/0"
# cat /etc/rc.local
dumpon gpt/dump/1
dumpon gpt/dump/2
dumpon gpt/dump/3
overkill, perhaps, but we've had swap devices fall off the bus and give us weird looking cores with no memory where there should be memory. this way, if the dump fails to one of the disks, it should try the rest of them before giving up.

if you've only got the one disk, you might try a small swap partition and then a bigger partition for dumping on.
 
we have an 8-way raidz3 pool with 128-gig "swap" partitions on each drive for our machine with 64 gigs of RAM. here's our setup:
Code:
# gmirror status
         Name    Status  Components
mirror/swap.a  COMPLETE  da1p1 (ACTIVE)
                         da2p1 (ACTIVE)
                         da0p1 (ACTIVE)
                         da3p1 (ACTIVE)
# grep mirror /etc/fstab
/dev/mirror/swap.a.eli none swap sw 0 0
# grep dumpdev /etc/rc.conf
dumpdev="gpt/dump/0"
# cat /etc/rc.local
dumpon gpt/dump/1
dumpon gpt/dump/2
dumpon gpt/dump/3
overkill, perhaps, but we've had swap devices fall off the bus and give us weird looking cores with no memory where there should be memory. this way, if the dump fails to one of the disks, it should try the rest of them before giving up.

if you've only got the one disk, you might try a small swap partition and then a bigger partition for dumping on.
I do prefer the system to use an encrypted zfs swap for virtual memory swapping. I only have the swap partition on the nvme drive to be a simple-as-possible place to crash due during a kpanic since I can't rely on geli+zfsroot working during a kpanic. I don't need 32G of ''swap memory'' just a simple place to kpanic and coredump to.
 
the .eli part in the fstab enables encrypted swap to the mirror. the point of our post was that you can configure a separate dump device from your swap device
 
Back
Top