The next section of the configuration file presents a critical concept that it is important to understand
–the idea of the effects relationship. An effects relationship creates a relationship between two variables so that when one variable changes the other variable is
In the next example, you can see that the value of _hp_pri_swap has been set to the size of the root disk and to the value of _hp_disk_layout (after that primary swap is initialized to a value more useful for swap).
This forces
#
#The next two statements are used only to establish an effects
#relationship between the _hp_pri_swap variable and _hp_root_disk &
#_hp_disk_layout variables. The value is overwritten below.
#This makes the UI change the swap anytime either of these two
#values change.
init _hp_pri_swap = disk[_hp_root_disk].size init _hp_pri_swap = _hp_disk_layout
#default (recommended) swap size is 2 X memory
#Round up to the nearest 64MB so that we don't get a warning
#about it being adjusted in the UI. Really this just needs
#to be rounded to be a multiple of the
#that can vary depending on the size of disk (4,8,16,32,64...)
#64MB should work on the majority of the disks available.
init _hp_pri_swap = (((MEMORY * 2) + 65535KB)/64MB)*64MB
Now you have other calculations for swap for different sized disks. The following example limits the size of swap for small disks. If you use init when setting both _hp_pri_swap and _hp_sec_swap, then the configuration only uses methods for setting the variables that allows the
#Put an upper bounds of 1024Mb to the default swap size for disks
#less than 5Gb. And 4Gb swap for other disks
_hp_pri_swap > 1024Mb { disk[_hp_root_disk].size < 5120Mb {
init _hp_pri_swap = 1024Mb } else {
_hp_pri_swap > 4096Mb { init _hp_pri_swap = 4096Mb }
}
}
#Use a 128Mb as the default minimum amount of swap configured on any
#system. The real swap space will be reduced down to _hp_min_swap if
#there is not enough file system space.
(_hp_pri_swap < 128Mb)
{init _hp_pri_swap = 128Mb }
#Initialize the swap range minimum to what the default is _hp_min_swap = _hp_pri_swap
#If the system is limited on resources, then reduce the minimum so
#that the OS has a better chance of fitting. The swap size will
#still be set to the recommended value if there is enough disk space. (_hp_min_swap > 512Mb & disk[_hp_root_disk].size < 3000Mb)
47