proc.txt

来自「Linux Kernel 2.6.9 for OMAP1710」· 文本 代码 · 共 1,564 行 · 第 1/5 页

TXT
1,564
字号
Registering a new binary format-------------------------------To register a new binary format you have to issue the command  echo :name:type:offset:magic:mask:interpreter: > /proc/sys/fs/binfmt_misc/register with appropriate  name (the name for the /proc-dir entry), offset (defaults to0, if  omitted),  magic, mask (which can be omitted, defaults to all 0xff) andlast but  not  least,  the  interpreter that is to be invoked (for example andtesting /bin/echo).  Type  can be M for usual magic matching or E for filenameextension matching (give extension in place of magic).Check or reset the status of the binary format handler------------------------------------------------------If you  do a cat on the file /proc/sys/fs/binfmt_misc/status, you will get thecurrent status (enabled/disabled) of binfmt_misc. Change the status by echoing0 (disables)  or  1  (enables)  or  -1  (caution:  this  clears all previouslyregistered binary  formats)  to status. For example echo 0 > status to disablebinfmt_misc (temporarily).Status of a single handler--------------------------Each registered  handler has an entry in /proc/sys/fs/binfmt_misc. These filesperform the  same function as status, but their scope is limited to the actualbinary format.  By  cating this file, you also receive all related informationabout the interpreter/magic of the binfmt.Example usage of binfmt_misc (emulate binfmt_java)--------------------------------------------------  cd /proc/sys/fs/binfmt_misc    echo ':Java:M::\xca\xfe\xba\xbe::/usr/local/java/bin/javawrapper:' > register    echo ':HTML:E::html::/usr/local/java/bin/appletviewer:' > register    echo ':Applet:M::<!--applet::/usr/local/java/bin/appletviewer:' > register   echo ':DEXE:M::\x0eDEX::/usr/bin/dosexec:' > register These four  lines  add  support  for  Java  executables and Java applets (likebinfmt_java, additionally  recognizing the .html extension with no need to put<!--applet> to  every  applet  file).  You  have  to  install  the JDK and theshell-script /usr/local/java/bin/javawrapper  too.  It  works  around  thebrokenness of  the Java filename handling. To add a Java binary, just create alink to the class-file somewhere in the path.2.3 /proc/sys/kernel - general kernel parameters------------------------------------------------This directory  reflects  general  kernel  behaviors. As I've said before, thecontents depend  on  your  configuration.  Here you'll find the most importantfiles, along with descriptions of what they mean and how to use them.acct----The file contains three values; highwater, lowwater, and frequency.It exists  only  when  BSD-style  process  accounting is enabled. These valuescontrol its behavior. If the free space on the file system where the log livesgoes below  lowwater  percentage,  accounting  suspends.  If  it  goes  abovehighwater percentage,  accounting  resumes. Frequency determines how often youcheck the amount of free space (value is in seconds). Default settings are: 4,2, and  30.  That is, suspend accounting if there is less than 2 percent free;resume it  if we have a value of 3 or more percent; consider information aboutthe amount of free space valid for 30 secondsctrl-alt-del------------When the value in this file is 0, ctrl-alt-del is trapped and sent to the initprogram to  handle a graceful restart. However, when the value is greater thatzero, Linux's  reaction  to  this key combination will be an immediate reboot,without syncing its dirty buffers.[NOTE]    When a  program  (like  dosemu)  has  the  keyboard  in  raw  mode,  the    ctrl-alt-del is  intercepted  by  the  program  before it ever reaches the    kernel tty  layer,  and  it is up to the program to decide what to do with    it.domainname and hostname-----------------------These files  can  be controlled to set the NIS domainname and hostname of yourbox. For the classic darkstar.frop.org a simple:  # echo "darkstar" > /proc/sys/kernel/hostname   # echo "frop.org" > /proc/sys/kernel/domainname would suffice to set your hostname and NIS domainname.osrelease, ostype and version-----------------------------The names make it pretty obvious what these fields contain:  > cat /proc/sys/kernel/osrelease   2.2.12      > cat /proc/sys/kernel/ostype   Linux      > cat /proc/sys/kernel/version   #4 Fri Oct 1 12:41:14 PDT 1999 The files  osrelease and ostype should be clear enough. Version needs a littlemore clarification.  The  #4 means that this is the 4th kernel built from thissource base and the date after it indicates the time the kernel was built. Theonly way to tune these values is to rebuild the kernel.panic-----The value  in  this  file  represents  the  number of seconds the kernel waitsbefore rebooting  on  a  panic.  When  you  use  the  software  watchdog,  therecommended setting  is  60. If set to 0, the auto reboot after a kernel panicis disabled, which is the default setting.printk------The four values in printk denote* console_loglevel,* default_message_loglevel,* minimum_console_loglevel and* default_console_loglevelrespectively.These values  influence  printk()  behavior  when  printing  or  logging errormessages, which  come  from  inside  the  kernel.  See  syslog(2)  for  moreinformation on the different log levels.console_loglevel----------------Messages with a higher priority than this will be printed to the console.default_message_level---------------------Messages without an explicit priority will be printed with this priority.minimum_console_loglevel------------------------Minimum (highest) value to which the console_loglevel can be set.default_console_loglevel------------------------Default value for console_loglevel.sg-big-buff-----------This file  shows  the size of the generic SCSI (sg) buffer. At this point, youcan't tune  it  yet,  but  you  can  change  it  at  compile  time  by editinginclude/scsi/sg.h and changing the value of SG_BIG_BUFF.If you use a scanner with SANE (Scanner Access Now Easy) you might want to setthis to a higher value. Refer to the SANE documentation on this issue.modprobe--------The location  where  the  modprobe  binary  is  located.  The kernel uses thisprogram to load modules on demand.unknown_nmi_panic-----------------The value in this file affects behavior of handling NMI. When the value isnon-zero, unknown NMI is trapped and then panic occurs. At that time, kerneldebugging information is displayed on console.NMI switch that most IA32 servers have fires unknown NMI up, for example.If a system hangs up, try pressing the NMI switch.[NOTE]   This function and oprofile share a NMI callback. Therefore this function   cannot be enabled when oprofile is activated.   And NMI watchdog will be disabled when the value in this file is set to   non-zero.2.4 /proc/sys/vm - The virtual memory subsystem-----------------------------------------------The files  in  this directory can be used to tune the operation of the virtualmemory (VM)  subsystem  of  the  Linux  kernel.vfs_cache_pressure------------------Controls the tendency of the kernel to reclaim the memory which is used forcaching of directory and inode objects.At the default value of vfs_cache_pressure=100 the kernel will attempt toreclaim dentries and inodes at a "fair" rate with respect to pagecache andswapcache reclaim.  Decreasing vfs_cache_pressure causes the kernel to preferto retain dentry and inode caches.  Increasing vfs_cache_pressure beyond 100causes the kernel to prefer to reclaim dentries and inodes.dirty_background_ratio----------------------Contains, as a percentage of total system memory, the number of pages at whichthe pdflush background writeback daemon will start writing out dirty data.dirty_ratio-----------------Contains, as a percentage of total system memory, the number of pages at whicha process which is generating disk writes will itself start writing out dirtydata.dirty_writeback_centisecs-------------------------The pdflush writeback daemons will periodically wake up and write `old' dataout to disk.  This tunable expresses the interval between those wakeups, in100'ths of a second.Setting this to zero disables periodic writeback altogether.dirty_expire_centisecs----------------------This tunable is used to define when dirty data is old enough to be eligiblefor writeout by the pdflush daemons.  It is expressed in 100'ths of a second. Data which has been dirty in-memory for longer than this interval will bewritten out next time a pdflush daemon wakes up.legacy_va_layout----------------If non-zero, this sysctl disables the new 32-bit mmap mmap layout - the kernelwill use the legacy (2.4) layout for all processes.lower_zone_protection---------------------For some specialised workloads on highmem machines it is dangerous forthe kernel to allow process memory to be allocated from the "lowmem"zone.  This is because that memory could then be pinned via the mlock()system call, or by unavailability of swapspace.And on large highmem machines this lack of reclaimable lowmem memorycan be fatal.So the Linux page allocator has a mechanism which prevents allocationswhich _could_ use highmem from using too much lowmem.  This means thata certain amount of lowmem is defended from the possibility of beingcaptured into pinned user memory.(The same argument applies to the old 16 megabyte ISA DMA region.  Thismechanism will also defend that region from allocations which could usehighmem or lowmem).The `lower_zone_protection' tunable determines how aggressive the kernel isin defending these lower zones.  The default value is zero - noprotection at all.If you have a machine which uses highmem or ISA DMA and yourapplications are using mlock(), or if you are running with no swap thenyou probably should increase the lower_zone_protection setting.The units of this tunable are fairly vague.  It is approximately equalto "megabytes".  So setting lower_zone_protection=100 will protect around 100megabytes of the lowmem zone from user allocations.  It will also makethose 100 megabytes unavaliable for use by applications and bypagecache, so there is a cost.The effects of this tunable may be observed by monitoring/proc/meminfo:LowFree.  Write a single huge file and observe the pointat which LowFree ceases to fall.A reasonable value for lower_zone_protection is 100.page-cluster------------page-cluster controls the number of pages which are written to swap ina single attempt.  The swap I/O size.It is a logarithmic value - setting it to zero means "1 page", settingit to 1 means "2 pages", setting it to 2 means "4 pages", etc.The default value is three (eight pages at a time).  There may be somesmall benefits in tuning this to a different value if your workload isswap-intensive.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.nr_hugepages and hugetlb_shm_group

⌨️ 快捷键说明

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