⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vm.txt

📁 嵌入式系统设计与实例开发实验教材二源码 多线程应用程序设计 串行端口程序设计 AD接口实验 CAN总线通信实验 GPS通信实验 Linux内核移植与编译实验 IC卡读写实验 SD驱动使
💻 TXT
字号:
Documentation for /proc/sys/vm/*	kernel version 2.2.10	(c) 1998, 1999,  Rik van Riel <riel@nl.linux.org>For general info and legal blurb, please look in README.==============================================================This file contains the documentation for the sysctl files in/proc/sys/vm and is valid for Linux kernel version 2.2.The files in this directory can be used to tune the operationof the virtual memory (VM) subsystem of the Linux kernel, andone of the files (bdflush) also has a little influence on diskusage.Default values and initialization routines for most of thesefiles can be found in mm/swap.c.Currently, these files are in /proc/sys/vm:- bdflush- buffermem- freepages- kswapd- overcommit_memory- page-cluster- pagecache- pagetable_cache==============================================================bdflush:This file controls the operation of the bdflush kerneldaemon. The source code to this struct can be found inlinux/fs/buffer.c. It currently contains 9 integer values,of which 4 are actually used by the kernel.From linux/fs/buffer.c:--------------------------------------------------------------union bdflush_param {	struct {		int nfract;	/* Percentage of buffer cache dirty to 				   activate bdflush */		int dummy1;	/* old "ndirty" */		int dummy2;	/* old "nrefill" */		int dummy3;	/* unused */		int interval;	/* jiffies delay between kupdate flushes */		int age_buffer;	/* Time for normal buffer to age */		int nfract_sync;/* Percentage of buffer cache dirty to 				   activate bdflush synchronously */		int dummy4;	/* unused */		int dummy5;	/* unused */	} b_un;	unsigned int data[N_PARAM];} bdf_prm = {{30, 64, 64, 256, 5*HZ, 30*HZ, 60, 0, 0}};--------------------------------------------------------------int nfract:The first parameter governs the maximum number of dirtybuffers in the buffer cache. Dirty means that the contentsof the buffer still have to be written to disk (as opposedto a clean buffer, which can just be forgotten about).Setting this to a high value means that Linux can delay diskwrites for a long time, but it also means that it will haveto do a lot of I/O at once when memory becomes short. A lowvalue will spread out disk I/O more evenly, at the cost ofmore frequent I/O operations.  The default value is 30%,the minimum is 0%, and the maximum is 100%.int interval:The fifth parameter, interval, is the minimum rate atwhich kupdate will wake and flush.  The value is expressed injiffies (clockticks), the number of jiffies per second isnormally 100 (Alpha is 1024). Thus, x*HZ is x seconds.  Thedefault value is 5 seconds, the minimum is 0 seconds, and themaximum is 600 seconds.int age_buffer:The sixth parameter, age_buffer, governs the maximum timeLinux waits before writing out a dirty buffer to disk.  Thevalue is in jiffies.  The default value is 30 seconds,the minimum is 1 second, and the maximum 6,000 seconds.int nfract_sync:The seventh parameter, nfract_sync, governs the percentageof buffer cache that is dirty before bdflush activatessynchronously.  This can be viewed as the hard limit beforebdflush forces buffers to disk.  The default is 60%, theminimum is 0%, and the maximum is 100%. ==============================================================buffermem:The three values in this file correspond to the values inthe struct buffer_mem. It controls how much memory shouldbe used for buffer memory. The percentage is calculatedas a percentage of total system memory.The values are:min_percent	-- this is the minimum percentage of memory		   that should be spent on buffer memoryborrow_percent  -- UNUSEDmax_percent     -- UNUSED==============================================================freepages:This file contains the values in the struct freepages. Thatstruct contains three members: min, low and high.The meaning of the numbers is:freepages.min	When the number of free pages in the system		reaches this number, only the kernel can		allocate more memory.freepages.low	If the number of free pages gets below this		point, the kernel starts swapping aggressively.freepages.high	The kernel tries to keep up to this amount of		memory free; if memory comes below this point,		the kernel gently starts swapping in the hopes		that it never has to do real aggressive swapping.==============================================================kswapd:Kswapd is the kernel swapout daemon. That is, kswapd is thatpiece of the kernel that frees memory when it gets fragmentedor full. Since every system is different, you'll probably wantsome control over this piece of the system.The numbers in this page correspond to the numbers in thestruct pager_daemon {tries_base, tries_min, swap_cluster}; The tries_base and swap_cluster probably have thelargest influence on system performance.tries_base	The maximum number of pages kswapd tries to		free in one round is calculated from this		number. Usually this number will be divided		by 4 or 8 (see mm/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 increase this number.tries_min	This is the minimum number of times kswapd		tries to free a page each time it is called.		Basically it's just there to make sure that		kswapd frees some pages even when it's being		called with minimum priority.swap_cluster	This is the number of pages kswapd writes in		one turn. You want this large so that kswapd		does it's I/O in large chunks and the disk		doesn't have to seek often, but you don't want		it to be too large since that would flood the		request queue.==============================================================overcommit_memory:This value contains a flag that enables memory overcommitment.When this flag is 0, the kernel checks before each malloc()to see if there's enough memory left. If the flag is nonzero,the system pretends there's always enough memory.This feature can be very useful because there are a lot ofprograms that malloc() huge amounts of memory "just-in-case"and don't use much of it.Look at: mm/mmap.c::vm_enough_memory() for more information.==============================================================page-cluster:The Linux VM subsystem avoids excessive disk seeks by readingmultiple pages on a page fault. The number of pages it readsis dependent on the amount of memory in your machine.The number of pages the kernel reads in at once is equal to2 ^ page-cluster. Values above 2 ^ 5 don't make much sensefor swap because we only cluster swap data in 32-page groups.==============================================================pagecache:This file does exactly the same as buffermem, only thisfile controls the struct page_cache, and thus controlsthe amount of memory used for the page cache.In 2.2, the page cache is used for 3 main purposes:- caching read() data from files- caching mmap()ed data and executable files- swap cacheWhen your system is both deep in swap and high on cache,it probably means that a lot of the swapped data is beingcached, making for more efficient swapping than possiblewith the 2.0 kernel.==============================================================pagetable_cache:The kernel keeps a number of page tables in a per-processorcache (this helps a lot on SMP systems). The cache size foreach processor will be between the low and the high value.On a low-memory, single CPU system you can safely set thesevalues to 0 so you don't waste the memory. On SMP systems itis used so that the system can do fast pagetable allocationswithout having to acquire the kernel memory lock.For large systems, the settings are probably OK. For normalsystems they won't hurt a bit. For small systems (<16MB ram)it might be advantageous to set both values to 0.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -