home *** CD-ROM | disk | FTP | other *** search
-
-
-
- sssswwwwaaaapppp((((1111MMMM)))) sssswwwwaaaapppp((((1111MMMM))))
-
-
-
- NNNNAAAAMMMMEEEE
- _ssss_wwww_aaaa_pppp - swap administrative interface
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_aaaa _[[[[_----_iiii_]]]]_[[[[_----_pppp_p_r_i_]]]]_[[[[_----_vvvv_v_l_e_n_]]]] _n_a_m_e _[[[[_l_o_w _[[[[_l_e_n_]]]]_]]]]
- _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_dddd _n_a_m_e/_l_s_w_a_p _[[[[_l_o_w_]]]]
- _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_llll _[[[[_----_nnnn_]]]]_[[[[_----_ffff_]]]]_[[[[_----_bbbb_]]]]
- _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_ssss _[[[[_----_bbbb_]]]]
- _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_mmmm
- _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_uuuu
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- _ssss_wwww_aaaa_pppp provides a method of adding, deleting, and monitoring the system
- swap areas used by the memory manager. The following options are
- recognized:
-
- _----_aaaa Add the specified swap resource. _n_a_m_e is the name of the block
- special partition, for example, _////_dddd_eeee_vvvv_////_dddd_ssss_kkkk_////_dddd_kkkk_ssss_0000_dddd_1111_ssss_1111 or a regular file.
- Files on NFS mounted file systems are also permitted (see SSSSwwwwaaaappppppppiiiinnnngggg
- ttttoooo NNNNFFFFSSSS FFFFiiiilllleeeessss below). _l_o_w is the offset in 512-byte blocks into the
- partition/file where the swap area should begin. If _l_o_w is absent,
- a default of 0 is used. This value is rounded up to a multiple of
- the system defined swap page size. _l_e_n is the length of the swap
- area in 512-byte blocks. If _l_e_n is absent, the new swap area will
- use the entire partition/file. This value is rounded down to a
- multiple of the system defined swap page size. Files used as swap
- devices must exist and have been previously grown to the appropriate
- size (see _mmmm_kkkk_ffff_iiii_llll_eeee(1m)). A maximum of 255 swap resources can be
- active at a given time. This option can only be used by a
- privileged user.
-
- Swap areas are normally added by modifying the _////_eeee_tttt_cccc_////_ffff_ssss_tttt_aaaa_bbbb file to
- contain the various files and partitions that should be added when
- the system is booted.
-
- When using the _----_aaaa or _----_mmmm option, _////_eeee_tttt_cccc_////_ffff_ssss_tttt_aaaa_bbbb is scanned for an entry
- whose _t_y_p_e field contains _ssss_wwww_aaaa_pppp and whose _f_i_l_e_s_y_s_t_e_m field matches
- _n_a_m_e. _n_a_m_e is made into a full path name. If an entry is found in
- _////_eeee_tttt_cccc_////_ffff_ssss_tttt_aaaa_bbbb, any supplied options are used to supplement any options
- given on the command line (e.g. priority).
-
- _----_iiii Ignore safety checks. Normally, when adding a block special device
- as a swap resource, a check is made to try to be certain that the
- block device does not overlap any existing file systems. This
- option turns off that check.
-
- _----_pppp _p_r_i
- Swap resources have a priority between 0 and 7 inclusive where lower
- priority swap resources are allocated from first. Within a
- priority, allocations are done round-robin. By default, block
- devices are assigned a priority of 0, files on local file systems
- are assigned a priority of 2 and files on NFS mounted file systems
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- sssswwwwaaaapppp((((1111MMMM)))) sssswwwwaaaapppp((((1111MMMM))))
-
-
-
- are assigned a priority of 4. This option is only valid when adding
- a swap resource.
-
- _----_vvvv _v_l_e_n_g_t_h
- Set the virtual length of the swap area to _v_l_e_n_g_t_h. Normally, if
- this field is not specified, the amount of logical swap is increased
- by the size of the physical swap device being added. This option
- tells the system to increase the logical swap amount by _v_l_e_n_g_t_h.
- Thus, the difference between _v_l_e_n_g_t_h and the actual size of the
- device is amount of _v_i_r_t_u_a_l swap that is added. The virtual length
- must be greater than or equal to the physical length of the swap
- area. If not specified, the virtual length is set equal to the
- actual length. See _ssss_wwww_aaaa_pppp_cccc_tttt_llll(2) for a discussion on virtual swap
- spaces. In general, this option should only be used when there is
- no other way to get enough swap resources (even via NFS) and it is
- understood the potential problems creating virtual swap can cause.
- See the discussion of Logical Swap Space below.
-
- _----_dddd Delete the specified swap resource. _n_a_m_e is the name of block
- special partition, for example, _////_dddd_eeee_vvvv_////_dddd_ssss_kkkk_////_dddd_kkkk_ssss_0000_dddd_1111_ssss_1111 or a regular file.
- If _n_a_m_e starts with a digit, it is interpreted as the logical swap
- number of the device to be deleted. This is useful when the file or
- device directory entry has been inadvertently been removed. _l_o_w is
- the offset in 512-byte blocks into the swap area to be deleted. If
- not specified, a default of 0 is used. Using this option marks the
- swap area as ``INDEL'' (in the process of being deleted). The
- system will not allocate any new blocks from the area, and will try
- to free swap blocks from it. The area will remain in use until all
- blocks from it are freed. This option can be used only by a
- privileged user.
-
- _----_mmmm Add all swap resources specified in _////_eeee_tttt_cccc_////_ffff_ssss_tttt_aaaa_bbbb ( _t_y_p_e field is
- sssswwwwaaaapppp). An entry with the name ////ddddeeeevvvv////sssswwwwaaaapppp is ignored, as are all
- entries with the nnnnooooaaaauuuuttttoooo option present. This option is primarily
- for the system start up script _////_eeee_tttt_cccc_////_iiii_nnnn_iiii_tttt_...._dddd_////_ssss_wwww_aaaa_pppp which, at boot time,
- adds all the administrator configured swap resources. This option
- can be used only by a privileged user.
-
- _----_uuuu Delete all swap resources except the original boot swap resource.
- This option is primarily for the system shutdown script
- _////_eeee_tttt_cccc_////_iiii_nnnn_iiii_tttt_...._dddd_////_ssss_wwww_aaaa_pppp which, at system shutdown time, deletes all the
- configured swap resources. The original boot swap resource may be
- explicitly deleted using the ----dddd option. This option can be used
- only by a privileged user.
-
- _----_llll List the status of all the swap areas. The output has either seven
- or nine columns depending on various options. By default, the
- listing contains nine columns and all values are in 512 byte blocks.
- The _----_nnnn option enables a new easier to read output format which
- defaults to printing the important seven columns (the additional two
- columns are printed if the _----_ffff option is specified). Values with the
- _----_nnnn option are printed in either bytes, or with the _----_bbbb option, in
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- sssswwwwaaaapppp((((1111MMMM)))) sssswwwwaaaapppp((((1111MMMM))))
-
-
-
- 512-byte blocks. The _----_ffff and _----_bbbb options are only recognized when the
- new output format is specified.
-
- _#### The logical swap number. This ranges from 1 to 255. This
- is column is labeled _llll_ssss_wwww_aaaa_pppp in the default listing format.
-
- _pppp_aaaa_tttt_hhhh The path name for the swap area.
-
- _dddd_eeee_vvvv The major/minor device number in decimal. This is printed
- in the default list format or in the new format if the _----_ffff
- option is present. If the swap resource is a block special
- device, this major/minor pair refers to the special device
- itself. If the swap resource is a regular file, the
- major/minor number is for the underlying file system that
- the file resides on. If the _s_t_a_t(2) on _pppp_aaaa_tttt_hhhh fails, '?,?' is
- printed.
-
- _pppp_rrrr_iiii The priority of the swap resource.
-
- _ssss_wwww_aaaa_pppp_llll_oooo The _s_w_a_p_l_o_w value for the area in 512-byte blocks. This is
- printed in the default list format or in the new format if
- the _----_ffff option is present. This value is rounded up to a
- multiple of the system defined swap page size.
-
- _pppp_ssss_wwww_aaaa_pppp The _s_w_a_p_l_e_n value for the area. This value is rounded down
- to a multiple of the system defined swap page size. This is
- column is labeled _bbbb_llll_oooo_cccc_kkkk_ssss in the default listing format.
-
- _ffff_rrrr_eeee_eeee The amount of free swap in the area.
-
- _mmmm_aaaa_xxxx_ssss_wwww_aaaa_pppp The maximum size the area will be grown to.
-
- _vvvv_ssss_wwww_aaaa_pppp The size over and above any physical space that the system
- is assuming it can use (see the discussion of logical swap
- space below, and the _----_vvvv option above).
-
- There are four status flags that may be printed after the last
- column. Normally functioning swap resources will not have any
- status flags. These flags are:
-
- _IIII_NNNN_DDDD_EEEE_LLLL The swap area is being deleted. No allocations will be made
- from this device.
-
- _EEEE_AAAA_CCCC_CCCC_EEEE_SSSS The swap area was on an NFS mounted file system and 'root'
- does not have permission to write the file. The swap area
- is immediately taken off line.
-
- _EEEE_SSSS_TTTT_AAAA_LLLL_EEEE The swap area was on an NFS mounted file system and the file
- was removed on the NFS server. The swap area is immediately
- taken off line. Processes with pages on the swap area will
- be terminated abnormally the first time they attempt to
- access any page that had been stored on the swap area.
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- sssswwwwaaaapppp((((1111MMMM)))) sssswwwwaaaapppp((((1111MMMM))))
-
-
-
- _IIII_OOOO_EEEE_RRRR_RRRR An I/O error occurred on the device. This could result in
- the abnormal termination of a process. Look in
- ////vvvvaaaarrrr////aaaaddddmmmm////SSSSYYYYSSSSLLLLOOOOGGGG for more details. Even with I/O errors, the
- swap area is still allocated from and used until deleted.
-
- _----_ssss Print information about total logical swap space usage. Values are
- printed in either bytes, or with the _----_bbbb option, in 512-byte blocks.
-
- _aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_dddd The amount of swap space allocated to private pages.
-
- _rrrr_eeee_ssss_eeee_rrrr_vvvv_eeee_dddd The amount of swap space not currently allocated, but
- claimed by private memory mappings.
-
- _uuuu_ssss_eeee_dddd The total amount of logical swap space that is either
- allocated or reserved.
-
- _aaaa_vvvv_aaaa_iiii_llll_aaaa_bbbb_llll_eeee The total logical swap space that is currently available
- for future reservation and allocation.
-
- SSSSWWWWAAAAPPPPPPPPIIIINNNNGGGG TTTTOOOO NNNNFFFFSSSS FFFFIIIILLLLEEEESSSS
- Swapping to regular files on NFS mounted file systems is permitted but
- should be done only with hard mounted file systems with the _i_n_t_r option
- turned off (see _ffff_ssss_tttt_aaaa_bbbb(4)). When using either soft mounted file systems
- or the _i_n_t_r option, NFS may return an error during a swap I/O operation.
- An I/O error that occurs when swapping in a page causes the process
- requesting the page to be killed, since it's address space is no longer
- accessible. Since it is possible for the _iiii_nnnn_iiii_tttt process to be swapped out
- to the NFS file, a timeout from a soft mounted file system that occurs
- while the system is swapping in a page for _iiii_nnnn_iiii_tttt will cause _iiii_nnnn_iiii_tttt to die.
- Since the system is unable to run without _iiii_nnnn_iiii_tttt, the system will in turn
- panic. Using hard mounted file systems without the _i_n_t_r flag avoids
- these problems.
-
- Even when using hard mounted NFS file systems, the system may appear to
- hang if the NFS server fails to respond. If the window manager, shell,
- or other key process is swapped out to the NFS file and the server fails
- to respond during swap-in, then the system will wait and retry the NFS
- file read indefinitely. During this time, programs attempting to swap-in
- pages from that server will not run and will appear to be hung. Once the
- NFS server starts responding again, normal system activity will resume.
-
- Finally, the system administrator must ensure that the swap file on the
- NFS server is not deleted. This would cause subsequent swap-ins to fail
- and again cause the associated processes to be killed.
-
- LLLLOOOOGGGGIIIICCCCAAAALLLL SSSSWWWWAAAAPPPP SSSSPPPPAAAACCCCEEEE
- Logical swap space is the sum total of physical memory (less space
- occupied by the kernel) and all swap devices. The system reserves
- logical swap space for the private portions of a process's virtual
- address space (data, bss, stack, MAP_PRIVATE mmap mappings, etc.) when
- virtual address spaces are created (via _ffff_oooo_rrrr_kkkk(2)), when they are grown
- (via _bbbb_rrrr_kkkk(2), _ssss_bbbb_rrrr_kkkk(2), or _mmmm_aaaa_llll_llll_oooo_cccc(3C)), or when new segments are attached
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-
-
-
- sssswwwwaaaapppp((((1111MMMM)))) sssswwwwaaaapppp((((1111MMMM))))
-
-
-
- (via _mmmm_mmmm_aaaa_pppp(2), or _ssss_hhhh_mmmm_aaaa_tttt(2)). Logical swap space is not required for
- shared text or MAP_SHARED mapped files (except for mappings of the
- /_d_e_v/_z_e_r_o device). If the amount of private virtual space requested
- exceeds the available logical swap space, the system call fails with
- EAGAIN and an "out of logical swap space" message is logged on the
- console. The system does this in order to prevent memory deadlocks from
- occurring.
-
- Note that the system may report being out of swap space when the _----_llll
- option shown above reports free swap space available. This happens when
- the logical swap space has been reserved, but physical space has not yet
- been allocated, so the blocks are still marked as being free. The _----_ssss
- option to the _ssss_wwww_aaaa_pppp command will report the amount of logical swap space
- reserved and allocated.
-
- Programs that have large address spaces and large programs that fork, may
- receive EAGAIN along with the "out of logical swap space" message on the
- console. This can also happen when debugging a large program with _dddd_bbbb_xxxx or
- other debugger. There are two ways to avoid this error: adding more real
- swap space, or adding virtual swap space. Adding real swap space means
- allocating an additional disk partition or a regular file (either local
- or remote via NFS) to be used as a swap device (using the _----_aaaa option shown
- above and the examples below). This is the required approach for
- programs that use most of the virtual addresses they allocate. The
- advantage of this approach is that it continues to avoid memory
- deadlocks, but requires physical disk space to be allocated.
-
- The alternative is to add virtual swap space using the _----_vvvv option. This
- increases the amount of logical swap space without using any physical
- disk space. This is suitable when the programs involved do not intend to
- use the virtual address space they allocate (i.e., when the address space
- is sparse or when a large program that forks intends to exec soon
- afterwards without modifying many pages). In these cases, physical swap
- space is not required and so adding virtual swap space allows the kernel
- to complete the logical swap space reservation and avoid the EAGAIN
- errors. The advantage of this approach is that it does not require any
- disk space, but adds the risk of encountering a memory deadlock. Memory
- deadlocks occur when the system has over-committed logical swap space by
- allowing the total private virtual space of the processes on the system
- to exceed real swap space. When processes attempt to use the allocated
- virtual space, the kernel has no place to store the data (since virtual
- swap space has no associated disk space), and a memory deadlock results.
- In these instances, the kernel kills one or more processes to free up
- enough logical swap space to break the deadlock. For this reason,
- virtual swap space should not be used in cases where the program will
- attempt to use the memory. For example, programs that expect _mmmm_aaaa_llll_llll_oooo_cccc(3C)
- to return _NNNN_UUUU_LLLL_LLLL when there is no more memory will in fact be allocated
- virtual memory that they could not use without causing a memory deadlock.
- The _----_vvvv option should therefore be used with care.
-
-
-
-
-
-
- PPPPaaaaggggeeee 5555
-
-
-
-
-
-
- sssswwwwaaaapppp((((1111MMMM)))) sssswwwwaaaapppp((((1111MMMM))))
-
-
-
- NNNNOOOOTTTTEEEESSSS
- The ability to request that a swap resource be automatically grown has
- not been implemented.
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
- The following _ssss_wwww_aaaa_pppp example requests 10K of swap area (twenty 512-byte
- blocks) on the device _////_dddd_eeee_vvvv_////_dddd_ssss_kkkk_////_dddd_kkkk_ssss_0000_dddd_1111_ssss_1111:
-
- _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_aaaa _////_dddd_eeee_vvvv_////_dddd_ssss_kkkk_////_dddd_kkkk_ssss_0000_dddd_1111_ssss_1111 _0000 _2222_0000
-
- The following adds 50Mb of swap space to the system using a file in the
- /_s_w_a_p directory:
-
- _////_uuuu_ssss_rrrr_////_ssss_bbbb_iiii_nnnn_////_mmmm_kkkk_ffff_iiii_llll_eeee _5555_0000_mmmm _////_ssss_wwww_aaaa_pppp_////_ssss_wwww_aaaa_pppp_1111
-
- _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_aaaa _////_ssss_wwww_aaaa_pppp_////_ssss_wwww_aaaa_pppp_1111
-
- To make this swap area permanent (automatically added at boot time) add
- the following line to /_e_t_c/_f_s_t_a_b:
-
- _////_ssss_wwww_aaaa_pppp_////_ssss_wwww_aaaa_pppp_1111 _ssss_wwww_aaaa_pppp _ssss_wwww_aaaa_pppp _pppp_rrrr_iiii_====_3333 _0000 _0000
-
- The following example adds the regular file _ssss_wwww_aaaa_pppp_1111 as a swap resource.
- Its priority is set to 5, and the system is told that it should add 100
- Mbytes (204800 512-byte blocks) to the virtual swap total. The example
- assumes that _ssss_wwww_aaaa_pppp_1111 is less than 100 Mbytes in length:
-
- _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_aaaa _----_pppp _5555 _----_vvvv _2222_0000_4444_8888_0000_0000 _ssss_wwww_aaaa_pppp_1111
-
- The following line in _////_eeee_tttt_cccc_////_ffff_ssss_tttt_aaaa_bbbb will add the same swap resource as the
- previous example, except that it will occur automatically at system
- startup time:
-
- _////_ssss_wwww_aaaa_pppp_////_ssss_wwww_aaaa_pppp_1111 _ssss_wwww_aaaa_pppp _ssss_wwww_aaaa_pppp _pppp_rrrr_iiii_====_5555_,,,,_vvvv_llll_eeee_nnnn_gggg_tttt_hhhh_====_2222_0000_4444_8888_0000_0000 _0000 _0000
-
- FFFFIIIILLLLEEEESSSS
- /etc/fstab swap and/or vswap to add at system boot
- /etc/config/vswap.options sets default size of virtual swap at boot
- /etc/init.d/swap adds/removes swap and/or vswap at boot/shutdown
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- mkfile(1M), mount(1M), swapctl(2), fstab(4).
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 6666
-
-
-
-