📄 proc.txt
字号:
dummy Unused dummy Unused ..............................................................................nfract------This parameter governs the maximum number of dirty buffers in the buffercache. Dirty means that the contents of the buffer still have to be written todisk (as opposed to a clean buffer, which can just be forgotten about).Setting this to a higher value means that Linux can delay disk writes for along time, but it also means that it will have to do a lot of I/O at once whenmemory becomes short. A lower value will spread out disk I/O more evenly.ndirty------Ndirty gives the maximum number of dirty buffers that bdflush can write to thedisk at one time. A high value will mean delayed, bursty I/O, while a smallvalue can lead to memory shortage when bdflush isn't woken up often enough.nrefill-------This is the number of buffers that bdflush will add to the list of freebuffers when refill_freelist() is called. It is necessary to allocate freebuffers beforehand, since the buffers are often different sizes than thememory pages and some bookkeeping needs to be done beforehand. The higher thenumber, the more memory will be wasted and the less often refill_freelist()will need to run.nref_dirt---------When refill_freelist() comes across more than nref_dirt dirty buffers, it willwake up bdflush.age_buffer and age_super------------------------Finally, the age_buffer and age_super parameters govern the maximum time Linuxwaits before writing out a dirty buffer to disk. The value is expressed injiffies (clockticks), the number of jiffies per second is 100. Age_buffer isthe maximum age for data blocks, while age_super is for filesystems meta data.buffermem---------The three values in this file control how much memory should be used forbuffer memory. The percentage is calculated as a percentage of total systemmemory.The values are:min_percent-----------This is the minimum percentage of memory that should be spent on buffermemory.borrow_percent--------------When Linux is short on memory, and the buffer cache uses more than it has beenallotted, the memory management (MM) subsystem will prune the buffer cachemore heavily than other memory to compensate.max_percent-----------This is the maximum amount of memory that can be used for buffer memory.freepages---------This file contains three values: min, low and high:min---When the number of free pages in the system reaches this number, only thekernel can allocate more memory.low---If the number of free pages falls below this point, the kernel starts swappingaggressively.high----The kernel tries to keep up to this amount of memory free; if memory fallsbelow this point, the kernel starts gently swapping in the hopes that it neverhas to do really aggressive swapping.kswapd------Kswapd is the kernel swap out daemon. That is, kswapd is that piece of thekernel that frees memory when it gets fragmented or full. Since every systemis different, you'll probably want some control over this piece of the system.The file contains three numbers:tries_base----------The maximum number of pages kswapd tries to free in one round is calculatedfrom this number. Usually this number will be divided by 4 or 8 (seemm/vmscan.c), so it isn't as big as it looks.When you need to increase the bandwidth to/from swap, you'll want to increasethis number.tries_min---------This is the minimum number of times kswapd tries to free a page each time itis called. Basically it's just there to make sure that kswapd frees some pageseven when it's being called with minimum priority.swap_cluster------------This is probably the greatest influence on system performance.swap_cluster is the number of pages kswapd writes in one turn. You'll wantthis value to be large so that kswapd does its I/O in large chunks and thedisk doesn't have to seek as often, but you don't want it to be too largesince that would flood the request queue.overcommit_memory-----------------This file contains one value. The following algorithm is used to decide ifthere's enough memory: if the value of overcommit_memory is positive, thenthere's always enough memory. This is a useful feature, since programs oftenmalloc() huge amounts of memory 'just in case', while they only use a smallpart of it. Leaving this value at 0 will lead to the failure of such a hugemalloc(), when in fact the system has enough memory for the program to run.On the other hand, enabling this feature can cause you to run out of memoryand thrash the system to death, so large and/or important servers will want toset this value to 0.pagecache---------This file does exactly the same job as buffermem, only this file controls theamount of memory allowed for memory mapping and generic caching of files.You don't want the minimum level to be too low, otherwise your system mightthrash when memory is tight or fragmentation is high.pagetable_cache---------------The kernel keeps a number of page tables in a per-processor cache (this helpsa lot on SMP systems). The cache size for each processor will be between thelow and the high value.On a low-memory, single CPU system, you can safely set these values to 0 soyou don't waste memory. It is used on SMP systems so that the system canperform fast pagetable allocations without having to acquire the kernel memorylock.For large systems, the settings are probably fine. For normal systems theywon't hurt a bit. For small systems ( less than 16MB ram) it might beadvantageous to set both values to 0.swapctl-------This file contains no less than 8 variables. All of these values are used bykswapd.The first four variables* sc_max_page_age,* sc_page_advance,* sc_page_decline and* sc_page_initial_ageare used to keep track of Linux's page aging. Page aging is a bookkeepingmethod to track which pages of memory are often used, and which pages can beswapped out without consequences.When a page is swapped in, it starts at sc_page_initial_age (default 3) andwhen the page is scanned by kswapd, its age is adjusted according to thefollowing scheme:* If the page was used since the last time we scanned, its age is increased by sc_page_advance (default 3). Where the maximum value is given by sc_max_page_age (default 20).* Otherwise (meaning it wasn't used) its age is decreased by sc_page_decline (default 1).When a page reaches age 0, it's ready to be swapped out.The variables sc_age_cluster_fract, sc_age_cluster_min, sc_pageout_weight andsc_bufferout_weight, can be used to control kswapd's aggressiveness inswapping out pages.Sc_age_cluster_fract is used to calculate how many pages from a process are tobe scanned by kswapd. The formula used is(sc_age_cluster_fract divided by 1024) times resident set sizeSo if you want kswapd to scan the whole process, sc_age_cluster_fract needs tohave a value of 1024. The minimum number of pages kswapd will scan isrepresented by sc_age_cluster_min, which is done so that kswapd will also scansmall processes.The values of sc_pageout_weight and sc_bufferout_weight are used to controlhow many tries kswapd will make in order to swap out one page/buffer. Thesevalues can be used to fine-tune the ratio between user pages and buffer/cachememory. When you find that your Linux system is swapping out too many processpages in order to satisfy buffer memory demands, you may want to eitherincrease sc_bufferout_weight, or decrease the value of sc_pageout_weight.2.5 /proc/sys/dev - Device specific parameters----------------------------------------------Currently there is only support for CDROM drives, and for those, there is onlyone read-only file containing information about the CD-ROM drives attached tothe system: >cat /proc/sys/dev/cdrom/info CD-ROM information, Id: cdrom.c 2.55 1999/04/25 drive name: sr0 hdb drive speed: 32 40 drive # of slots: 1 0 Can close tray: 1 1 Can open tray: 1 1 Can lock tray: 1 1 Can change speed: 1 1 Can select disk: 0 1 Can read multisession: 1 1 Can read MCN: 1 1 Reports media changed: 1 1 Can play audio: 1 1 You see two drives, sr0 and hdb, along with a list of their features.2.6 /proc/sys/sunrpc - Remote procedure calls---------------------------------------------This directory contains four files, which enable or disable debugging for theRPC functions NFS, NFS-daemon, RPC and NLM. The default values are 0. They canbe set to one to turn debugging on. (The default value is 0 for each)2.7 /proc/sys/net - Networking stuff------------------------------------The interface to the networking parts of the kernel is located in/proc/sys/net. Table 2-3 shows all possible subdirectories. You may see onlysome of them, depending on your kernel's configuration.Table 2-3: Subdirectories in /proc/sys/net .............................................................................. Directory Content Directory Content core General parameter appletalk Appletalk protocol unix Unix domain sockets netrom NET/ROM 802 E802 protocol ax25 AX25 ethernet Ethernet protocol rose X.25 PLP layer ipv4 IP version 4 x25 X.25 protocol ipx IPX token-ring IBM token ring bridge Bridging decnet DEC net ipv6 IP version 6 ..............................................................................We will concentrate on IP networking here. Since AX15, X.25, and DEC Net areonly minor players in the Linux world, we'll skip them in this chapter. You'llfind some short info on Appletalk and IPX further on in this chapter. Reviewthe online documentation and the kernel source to get a detailed view of theparameters for those protocols. In this section we'll discuss thesubdirectories printed in bold letters in the table above. As default valuesare suitable for most needs, there is no need to change these values./proc/sys/net/core - Network core options-----------------------------------------rmem_default------------The default setting of the socket receive buffer in bytes.rmem_max--------The maximum receive socket buffer size in bytes.wmem_default------------The default setting (in bytes) of the socket send buffer.wmem_max--------The maximum send socket buffer size in bytes.message_burst and message_cost------------------------------These parameters are used to limit the warning messages written to the kernellog from the networking code. They enforce a rate limit to make adenial-of-service attack impossible. A higher message_cost factor, results infewer messages that will be written. Message_burst controls when messages willbe dropped. The default settings limit warning messages to one every fiveseconds.netdev_max_backlog------------------Maximum number of packets, queued on the INPUT side, when the interfacereceives packets faster than kernel can process them.optmem_max----------Maximum ancillary buffer size allowed per socket. Ancillary data is a sequenceof struct cmsghdr structures with appended data./proc/sys/net/unix - Parameters for Unix domain sockets
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -