New freebsd-swap space with 400GB but htop shows 66.0G

s0undsp4c3

Member

Reaction score: 2
Messages: 22

Hi daemons,

I created a new partition:
Code:
sudo gpart add -t freebsd-swap -i 2 ada 2
sudo swapon /dev/ada2p2

It works great but, the whole partition is of 400G but, htop only shows `66.0G`

Why is that?
 
OP
s0undsp4c3

s0undsp4c3

Member

Reaction score: 2
Messages: 22

Thanks for reply. Really not needed but, wanted to know if that can be changed. Can it be? -- I guess no.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,618
Messages: 37,958

There are some limits you're going to run into. One of them the max size of a single swap partition, so you're going to need to create multiple 64GB partitions. But then you're also going to run into various paging limits that need to be adjusted too. Can it be changed? Sure. Should you? No, not unless you have a good reason to do so.
 

ptx

New Member


Messages: 2

Hm... I'm just about to install a system with 64 GB RAM. The handbook advises that swap should be "double the size of physical memory" which would mean 128 GB swap. Is this a bad recommendation?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,618
Messages: 37,958

Is this a bad recommendation?
No, just very old, it still stems from a time when systems had a few MB of memory. There's some debate about the "optimal" size but I generally don't make my swap bigger than 8GB regardless of how much memory the system has. There are only a few use-cases that would warrant a bigger swap.
 

bakul

Member

Reaction score: 42
Messages: 92

If you plan to save crashdumps the total space (may be split over multiple devices) should be at least as large as physical memory. Though in practice you will likely have no use for saving crashdumps!
 

bakul

Member

Reaction score: 42
Messages: 92

Devices marked dump or swap in /etc/fstab are used for storing the crashdump on kernel panic. You can now netdump. Also, the default is minidump (memory in use by the kernel) so... you can get by with less. I have two partitions 64GB each on a machine with 64GB RAM but in 3 years I haven't saved a single crashdump!
 

ptx

New Member


Messages: 2

What about the handbook's warning that configuring a smaller swap size "can lead to inefficiencies in the VM page scanning code"? Has that part of the kernel since then been improved in this regard, or will performance be significantly affected by a smaller swap size?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,618
Messages: 37,958

What about the handbook's warning that configuring a smaller swap size "can lead to inefficiencies in the VM page scanning code"?
Also stems from a time when memory was measured in MB.

or will performance be significantly affected by a smaller swap size?
Swap shouldn't be used at all in an ideal situation. If you have enough memory nothing will get swapped out. You configure swap to account for some run away processes that might make the system run out of memory. It buys you some extra time before the out-of-memory killer starts killing processes.
 

Alain De Vos

Daemon

Reaction score: 548
Messages: 1,893

Example, when I run poudriere with 64 parallel processes and 8G memory, next morning my computer is rebooted, which is normal because sooner or later you run out of swapspace. It's a question of "dimensioning".
 
Top