Difference between revisions of "ProcFS"

From Linux-VServer

Jump to: navigation, search
(+cat)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Information abaut the current runtime conditions can be found inside the /proc directory. The very most information is read-only. Because it usually is world-readable you do not have to gain root access to look at this information. Files explained on this page are:
+
Information about currently running contexts can be found inside the /proc/virtual and /proc/virtnet directory. All information provided there is read-only, i.e. it cannot be used to change any values like other entries in /proc may do. Because it usually is world-readable you do not have to gain root access to look at this information.
  
/proc/virtual
+
Beside this information you can also control various debugging related settings using /proc/sys/vserver/debug if you have enabled debugging in your kernel configuration.
  .../info
+
  
/proc/virtual/<id>
+
'''Note:''' The examples and descriptions are based on the 2.1.1 kernel patch. If you're using a previous version some information may not be present and/or available with a slightly different name.
  .../info
+
  .../status
+
  .../sched
+
  .../cvirt
+
  .../cacct
+
  .../limit
+
  
== Per Host ==
+
== Generic information ==
Regarding the host system there is only one file present:
+
 
 +
Currently there is only one file with generic information about the vserver host, that is /proc/virtual/info:
  
 
=== info ===
 
=== info ===
  
/proc/virtual/info
+
<pre>
VCIVersion:    0002:0002
+
# cat /proc/virtual/info
VCISyscall:    236
+
VCIVersion:    0002:0002
VCIKernel:      03000016
+
VCISyscall:    236
 +
VCIKernel:      03000016
 +
</pre>
  
You may compare this info to the output of "vserver-info"; you will recognize two of those entries under a slightly different name while VCIKernel seems to be missing:
+
; VCIVersion : Current API version of the kernel
 +
; VCISyscall : Syscall number of the vserver syscall
 +
; VCIKernel : Bitmask of the CONFIG_VSERVER kernel configuration options
  
x2:~# vserver-info
+
Beside ''VCIKernel'' the information provided in this file can also be gathered using the ''vserver-info'' utility from util-vserver.
Versions:
+
                  Kernel: 2.6.17-2-vserver-amd64
+
                  VS-API: 0x00020002
+
            util-vserver: 0.30.210; Sep 30 2006, 23:55:41
+
Features:
+
                      CC: gcc, gcc (GCC) 4.1.2 20060928 (prerelease) (Debian 4.1.1-15)
+
                      CXX: g++, g++ (GCC) 4.1.2 20060928 (prerelease) (Debian 4.1.1-15)
+
                CPPFLAGS: ''
+
                  CFLAGS: '-Wall -g  -O2 -std=c99 -Wall -pedantic -W -funit-at-a-time'
+
                CXXFLAGS: '-g -O2 -ansi -Wall -pedantic -W -fmessage-length=0 -funit-at-a-time'
+
              build/host: x86_64-pc-linux-gnu/x86_64-pc-linux-gnu
+
            Use dietlibc: yes
+
      Build C++ programs: yes
+
      Build C99 programs: yes
+
          Available APIs: compat,v11,fscompat,v13,net,oldproc,olduts
+
            ext2fs Source: e2fsprogs
+
    syscall(2) invocation: alternative
+
      vserver(2) syscall#: 236/glibc
+
  
== Per vserver instance ==
+
<pre>
 +
# vserver-info
 +
Versions:
 +
                  Kernel: 2.6.17-2-vserver-amd64
 +
                  VS-API: 0x00020002
 +
            util-vserver: 0.30.210; Sep 30 2006, 23:55:41
 +
Features:
 +
                      CC: gcc, gcc (GCC) 4.1.2 20060928 (prerelease) (Debian 4.1.1-15)
 +
                    CXX: g++, g++ (GCC) 4.1.2 20060928 (prerelease) (Debian 4.1.1-15)
 +
                CPPFLAGS: ''
 +
                  CFLAGS: '-Wall -g  -O2 -std=c99 -Wall -pedantic -W -funit-at-a-time'
 +
                CXXFLAGS: '-g -O2 -ansi -Wall -pedantic -W -fmessage-length=0 -funit-at-a-time'
 +
              build/host: x86_64-pc-linux-gnu/x86_64-pc-linux-gnu
 +
            Use dietlibc: yes
 +
      Build C++ programs: yes
 +
      Build C99 programs: yes
 +
          Available APIs: compat,v11,fscompat,v13,net,oldproc,olduts
 +
          ext2fs Source: e2fsprogs
 +
  syscall(2) invocation: alternative
 +
    vserver(2) syscall#: 236/glibc
 +
</pre>
 +
 
 +
== Context specific information ==
  
 
=== info ===
 
=== info ===
This shows the context id, vx_info location and init pid
+
<pre>
 +
# cat /proc/virtual/<xid>/info
 +
ID: 1001
 +
Info: 83c37000
 +
Init: 0
 +
</pre>
  
/proc/virtual/<id>/info
+
; ID : Context ID
ID: 1001
+
; Info : Memory location of the vx_info structure
Info: 83c37000
+
; Init : Real PID of the init process
Init: 0
+
  
 
=== status ===
 
=== status ===
This contains the usage count (references) and task count, as well as the context flags, capability boundary and context capabilities
 
  
/proc/virtual/<id>/status  
+
This file contains general status information.
UseCnt: 38
+
 
Tasks: 16
+
<pre>
Flags: 0000000000000000
+
# cat /proc/virtual/<xid>/status  
BCaps: 00000000d46c04ff
+
UseCnt: 38
CCaps: 0000000000000000
+
Tasks: 16
Ticks: 0
+
Flags: 0000000002020010
 +
BCaps: 00000000344c04ff
 +
CCaps: 0000000000000101
 +
</pre>
 +
 
 +
; UseCnt : References to the vx_info struct
 +
; Tasks : Number of processes (tasks) inside the context
 +
; Flags : [[Capabilities and Flags]]
 +
; BCaps : [[Capabilities and Flags]]
 +
; CCaps : [[Capabilities and Flags]]
  
 
=== sched ===
 
=== sched ===
Shows the current amount of tokens, scheduler parameters (fill rate, interval, min/max), the priority bias and the calculated vavavoom (priority bonus)
 
  
/proc/virtual/<id>/sched  
+
This file contains information about the [[CPU Scheduler]].
Token:       0
+
 
FillRate:       1
+
<pre>
Interval:       4
+
# cat /proc/virtual/<xid>/sched  
TokensMin:       6
+
FillRate:             1,1
TokensMax:       50
+
Interval:             4,8
PrioBias:       0
+
TokensMin:           15
VaVaVoom:       0
+
TokensMax:           125
cpu 0: 0 0 0
+
PrioBias:             0
 +
VaVaVoom:             0
 +
cpu 0: 0 0 0 0 0 R- 62 15 125 1/4 1/8
 +
</pre>
 +
 
 +
; FillRate : Number of tokens filled into the bucket at each interval
 +
; Interval : Number of jiffies between each fill interval
 +
; TokensMin : Minimum number of tokens to be scheduled
 +
; TokensMax : Maximum number of tokens in the bucket
 +
; PrioBias : Priority bias
 +
; VaVaVoom : The calculated priority bonus a guest gets
 +
; cpu X
 +
: Ticks spent in user-space
 +
: Ticks spent in kernel-space
 +
: Ticks spent on hold
 +
: Token time ??
 +
: Idle time ??
 +
: On hold (H) or running (R)
 +
: Uses IDLE time (I) or not (-)
 +
: Current number of tokens
 +
: Minimum number of tokens to be scheduled
 +
: Maximum number of tokens in the bucket
 +
: Minimum number of tokens to be scheduled (IDLE time setting)
 +
: Maximum number of tokens in the bucket (IDLE time setting)
  
 
=== cacct ===
 
=== cacct ===
This one accounts socket messages for the listed protocols, as incoming messages/bytes and outgoing messages/bytes
 
  
/proc/virtual/<id>/cacct  
+
This file contains information about [[Context Accounting]], including socket accounting and slab allocator accounting.
UNSPEC:     0/0                     0/0                     0/0          
+
 
UNIX:           35/2375                  35/2375                  0/0          
+
<pre>
INET:           12/531                  56/1937                  57/1705       
+
# cat /proc/virtual/<xid>/cacct  
INET6:           0/0                     0/0                     0/0          
+
Type        recv #/bytes                  send #/bytes            fail #/bytes
OTHER:           0/0                     0/0                     0/0           
+
UNSPEC:         0/0                     0/0                     0/0
forks: 0
+
UNIX:           0/0                    0/0                    0/0
 +
INET:           0/0                    0/0                    0/0
 +
INET6:           0/0                     0/0                     0/0
 +
PACKET:          0/0                    0/0                    0/0
 +
OTHER:           0/0                     0/0                     0/0
 +
 
 +
slab:           0        0 4294965416        0
 +
 
 +
page[0]:       0       0        0        0            0        0        0        0
 +
page[1]:        0        0        0        0            0        0        0        0
 +
page[2]:        0        0        0        0            0        0        0        0
 +
page[3]:        0        0        0        0            0        0        0        0
 +
page[4]:        0        0        0        0            0        0        0        0
 +
</pre>
 +
 
  
 
=== cvirt ===
 
=== cvirt ===
This contains the uptime bias, utsname settings (sys, node, rel, vers, machine, domain), the number of threads, thread stats (running, uninterruptible, on hold), the number of load updates, the load averages (1,5,15) and the number of forks
 
  
/proc/virtual/<id>/cvirt  
+
This file contains information about virtualized data, including context uptime bias, utsname settings, thread information and load average.
BiasUptime: 49.73
+
Note: some fields are moved in nsproxy file with vs2.3.x.
SysName: Linux
+
 
NodeName: XXXX.test.org
+
<pre>
Release: 2.6.11-rc5
+
# cat /proc/virtual/<xid>/cvirt  
Version: #12 Sun Feb 27 01:07:29 CET 2005
+
BiasUptime: 49.73
Machine: i686
+
SysName: Linux
DomainName:
+
NodeName: XXXX.test.org
nr_threads: 16
+
Release: 2.6.11-rc5
nr_running: 0
+
Version: #12 Sun Feb 27 01:07:29 CET 2005
nr_unintr: 0
+
Machine: i686
nr_onhold: 0
+
DomainName:
load_updates: 14585
+
nr_threads: 16
loadavg: 0.00 0.00 0.00
+
nr_running: 0
total_forks: 272
+
nr_unintr: 0
 +
nr_onhold: 0
 +
load_updates: 14585
 +
loadavg: 0.00 0.00 0.00
 +
total_forks: 272
 +
</pre>
 +
 
 +
; BiasUptime : Context uptime bias (System uptime - BiasUptime = Context uptime)
 +
; SysName : Kernel name
 +
; NodeName : Network node hostname
 +
; Release : Kernel release
 +
; Version : Kernel version
 +
; Machine : Machine hardware name
 +
; DomainName : Network node domainname
 +
; nr_threads : Total number of threads
 +
; nr_running : Number of running threads
 +
; nr_unintr : Number of uninterruptible threads
 +
; nr_onhold : Number of threads on hold
 +
; load_updates : Total number of load average updates
 +
; loadavg : Number of jobs in the run queue averaged over 1, 5, and 15 minutes
 +
; total_forks : Total number of forks
 +
 
 +
=== nsproxy ===
 +
 
 +
Vs 2.3.x (experimental) only.
 +
 
 +
<pre>
 +
NSProxy: ffff81000460d338 [ffff81007cca9bc0,ffff8100378d5800,ffff8100378e7600]
 +
Namespace: ffff81007cca9bc0 [#2]
 +
RootPath: /
 +
SysName: Linux
 +
NodeName: lenny-amd64
 +
Release: 2.6.26-1-vserver-amd64
 +
Version: #1 SMP Sat Jan 10 19:46:42 UTC 2009
 +
Machine: x86_64
 +
DomainName: (none)
 +
SEMS: 250 32000 32 128  0
 +
MSG: 8192 16384 286
 +
SHM: 33554432 2097152  4096 0
 +
</pre>
  
 
=== limit ===
 
=== limit ===
Limit columns are: current (1), max observed (2), limit (3) and number of hits (4)
 
  
Limit rows are: processes, virtual memory, locked memory, resident set size, anonymous memory, number of files, filedescriptors, locks, sockets, message queues, and shared memory
+
This file contains information about [[Resource Limits]], including [[Context Accounting]] (i.e these do not appear in cacct).
  
/proc/virtual/<id>/limit  
+
<pre>
PROC:         16         17         -1     0
+
# cat /proc/virtual/<xid>/limit  
VM:     14440     15331         -1     0
+
Limit    current            min/max                soft/hard          hits
VML:         0         0         -1     0
+
PROC:         2              2/      2            -1/     -1            0
RSS:       5478       5847         -1     0
+
VM:        4024            4024/    4024            -1/     -1            0
ANON:       1516       1516         -1     0
+
VML:           0               0/      0            -1/     -1            0
FILES:       140       155         -1     0
+
RSS:         50              50/      50            -1/     -1            0
OFD:       122       122         -1     0
+
ANON:        33              33/      33            -1/     -1            0
LOCKS:         1         3         -1     0
+
FILES:        19              19/      19            -1/     -1            0
SOCK:         9         9         -1     0
+
OFD:           5              5/      5            -1/     -1            0
MSGQ:         0         0         -1     0
+
LOCKS:        0              0/      0            -1/     -1            0
SHM:         0         0         -1     0
+
SOCK:          2              2/      2            -1/     -1            0
 +
MSGQ:          0               0/      0            -1/     -1            0
 +
SHM:          0              0/      0            -1/      -1            0
 +
SEMA:          0               0/      0            -1/      -1            0
 +
SEMS:         0               0/      0            -1/     -1            0
 +
DENT:      2315            2315/    2315            -1/      -1            0
 +
</pre>
  
== Debugging Control ==
+
; Limit : Limit name/identifier
This complete directory seems not to be present by default. Possibly there is a compile- or a runtime-switch to enable debugging.
+
; current : Current value
 +
; min : Minimum value since the last reset
 +
; max : Maximum value since the last reset
 +
; soft : Soft limit
 +
; hard : hard limit
 +
; hits : Total amount of current reaching hard
  
/proc/sys/vserver
+
== Debugging Control ==
  .../debug_switch
+
  .../debug_xid
+
  .../debug_cvirt
+
  .../debug_limit
+
  .../debug_dlim
+
  .../debug_nid
+
  .../debug_net
+
/proc/sys/vserver/debug_switch
+
/proc/sys/vserver/debug_xid
+
/proc/sys/vserver/debug_cvirt
+
/proc/sys/vserver/debug_limit
+
/proc/sys/vserver/debug_dlim
+
/proc/sys/vserver/debug_nid
+
/proc/sys/vserver/debug_net
+
  
If the directory exist you should be able to create these files by issuing commands like:
+
The /proc/sys/vserver/debug directory is only present if you have enabled CONFIG_VSERVER_DEBUG during kernel compilation.
  
echo 255 >/proc/sys/vserver/debug_switch
+
To enable debugging you can use a command similar to the following to enable debugging. Please see [[Kernel Debugging]] for more information.
  
The bigger problem is to find out which values are useful, see [[Debugging]] for details.
+
<pre>
 +
# echo 255 >/proc/sys/vserver/debug_switch
 +
</pre>
  
----
+
[[Category:Theory]]
''Please note: some samples are simply copied from the old wiki at http://oldwiki.linux-vserver.org/HowTo+Read+ProcFS, some other are captured from an Athlon AMD X2 system. They do not necessarily fit together.''
+

Latest revision as of 20:26, 21 October 2011

Information about currently running contexts can be found inside the /proc/virtual and /proc/virtnet directory. All information provided there is read-only, i.e. it cannot be used to change any values like other entries in /proc may do. Because it usually is world-readable you do not have to gain root access to look at this information.

Beside this information you can also control various debugging related settings using /proc/sys/vserver/debug if you have enabled debugging in your kernel configuration.

Note: The examples and descriptions are based on the 2.1.1 kernel patch. If you're using a previous version some information may not be present and/or available with a slightly different name.

Contents

[edit] Generic information

Currently there is only one file with generic information about the vserver host, that is /proc/virtual/info:

[edit] info

# cat /proc/virtual/info
VCIVersion:     0002:0002
VCISyscall:     236
VCIKernel:      03000016
VCIVersion 
Current API version of the kernel
VCISyscall 
Syscall number of the vserver syscall
VCIKernel 
Bitmask of the CONFIG_VSERVER kernel configuration options

Beside VCIKernel the information provided in this file can also be gathered using the vserver-info utility from util-vserver.

# vserver-info
Versions:
                  Kernel: 2.6.17-2-vserver-amd64
                  VS-API: 0x00020002
            util-vserver: 0.30.210; Sep 30 2006, 23:55:41
Features:
                      CC: gcc, gcc (GCC) 4.1.2 20060928 (prerelease) (Debian 4.1.1-15)
                     CXX: g++, g++ (GCC) 4.1.2 20060928 (prerelease) (Debian 4.1.1-15)
                CPPFLAGS: ''
                  CFLAGS: '-Wall -g  -O2 -std=c99 -Wall -pedantic -W -funit-at-a-time'
                CXXFLAGS: '-g -O2 -ansi -Wall -pedantic -W -fmessage-length=0 -funit-at-a-time'
              build/host: x86_64-pc-linux-gnu/x86_64-pc-linux-gnu
            Use dietlibc: yes
      Build C++ programs: yes
      Build C99 programs: yes
          Available APIs: compat,v11,fscompat,v13,net,oldproc,olduts
           ext2fs Source: e2fsprogs
   syscall(2) invocation: alternative
     vserver(2) syscall#: 236/glibc

[edit] Context specific information

[edit] info

# cat /proc/virtual/<xid>/info
ID:	1001
Info:	83c37000
Init:	0
ID 
Context ID
Info 
Memory location of the vx_info structure
Init 
Real PID of the init process

[edit] status

This file contains general status information.

# cat /proc/virtual/<xid>/status 
UseCnt:	38
Tasks:	16
Flags:	0000000002020010
BCaps:	00000000344c04ff
CCaps:	0000000000000101
UseCnt 
References to the vx_info struct
Tasks 
Number of processes (tasks) inside the context
Flags 
Capabilities and Flags
BCaps 
Capabilities and Flags
CCaps 
Capabilities and Flags

[edit] sched

This file contains information about the CPU Scheduler.

# cat /proc/virtual/<xid>/sched 
FillRate:              1,1
Interval:              4,8
TokensMin:            15
TokensMax:           125
PrioBias:              0
VaVaVoom:              0
cpu 0: 0 0 0 0 0 R- 62 15 125 1/4 1/8
FillRate 
Number of tokens filled into the bucket at each interval
Interval 
Number of jiffies between each fill interval
TokensMin 
Minimum number of tokens to be scheduled
TokensMax 
Maximum number of tokens in the bucket
PrioBias 
Priority bias
VaVaVoom 
The calculated priority bonus a guest gets
cpu X
Ticks spent in user-space
Ticks spent in kernel-space
Ticks spent on hold
Token time ??
Idle time ??
On hold (H) or running (R)
Uses IDLE time (I) or not (-)
Current number of tokens
Minimum number of tokens to be scheduled
Maximum number of tokens in the bucket
Minimum number of tokens to be scheduled (IDLE time setting)
Maximum number of tokens in the bucket (IDLE time setting)

[edit] cacct

This file contains information about Context Accounting, including socket accounting and slab allocator accounting.

# cat /proc/virtual/<xid>/cacct 
Type        recv #/bytes                   send #/bytes             fail #/bytes
UNSPEC:          0/0                     0/0                     0/0
UNIX:            0/0                     0/0                     0/0
INET:            0/0                     0/0                     0/0
INET6:           0/0                     0/0                     0/0
PACKET:          0/0                     0/0                     0/0
OTHER:           0/0                     0/0                     0/0

slab:           0        0 4294965416        0

page[0]:        0        0        0        0            0        0        0        0
page[1]:        0        0        0        0            0        0        0        0
page[2]:        0        0        0        0            0        0        0        0
page[3]:        0        0        0        0            0        0        0        0
page[4]:        0        0        0        0            0        0        0        0


[edit] cvirt

This file contains information about virtualized data, including context uptime bias, utsname settings, thread information and load average. Note: some fields are moved in nsproxy file with vs2.3.x.

# cat /proc/virtual/<xid>/cvirt 
BiasUptime:	49.73
SysName:	Linux
NodeName:	XXXX.test.org
Release:	2.6.11-rc5
Version:	#12 Sun Feb 27 01:07:29 CET 2005
Machine:	i686
DomainName:	
nr_threads:	16
nr_running:	0
nr_unintr:	0
nr_onhold:	0
load_updates:	14585
loadavg:	0.00 0.00 0.00
total_forks:	272
BiasUptime 
Context uptime bias (System uptime - BiasUptime = Context uptime)
SysName 
Kernel name
NodeName 
Network node hostname
Release 
Kernel release
Version 
Kernel version
Machine 
Machine hardware name
DomainName 
Network node domainname
nr_threads 
Total number of threads
nr_running 
Number of running threads
nr_unintr 
Number of uninterruptible threads
nr_onhold 
Number of threads on hold
load_updates 
Total number of load average updates
loadavg 
Number of jobs in the run queue averaged over 1, 5, and 15 minutes
total_forks 
Total number of forks

[edit] nsproxy

Vs 2.3.x (experimental) only.

NSProxy:	ffff81000460d338 [ffff81007cca9bc0,ffff8100378d5800,ffff8100378e7600]
Namespace:	ffff81007cca9bc0 [#2]
RootPath:	/
SysName:	Linux
NodeName:	lenny-amd64
Release:	2.6.26-1-vserver-amd64
Version:	#1 SMP Sat Jan 10 19:46:42 UTC 2009
Machine:	x86_64
DomainName:	(none)
SEMS:		250 32000 32 128  0
MSG:		8192 16384 286
SHM:		33554432 2097152  4096 0

[edit] limit

This file contains information about Resource Limits, including Context Accounting (i.e these do not appear in cacct).

# cat /proc/virtual/<xid>/limit 
Limit    current             min/max                soft/hard           hits
PROC:          2               2/       2             -1/      -1            0
VM:         4024            4024/    4024             -1/      -1            0
VML:           0               0/       0             -1/      -1            0
RSS:          50              50/      50             -1/      -1            0
ANON:         33              33/      33             -1/      -1            0
FILES:        19              19/      19             -1/      -1            0
OFD:           5               5/       5             -1/      -1            0
LOCKS:         0               0/       0             -1/      -1            0
SOCK:          2               2/       2             -1/      -1            0
MSGQ:          0               0/       0             -1/      -1            0
SHM:           0               0/       0             -1/      -1            0
SEMA:          0               0/       0             -1/      -1            0
SEMS:          0               0/       0             -1/      -1            0
DENT:       2315            2315/    2315             -1/      -1            0
Limit 
Limit name/identifier
current 
Current value
min 
Minimum value since the last reset
max 
Maximum value since the last reset
soft 
Soft limit
hard 
hard limit
hits 
Total amount of current reaching hard

[edit] Debugging Control

The /proc/sys/vserver/debug directory is only present if you have enabled CONFIG_VSERVER_DEBUG during kernel compilation.

To enable debugging you can use a command similar to the following to enable debugging. Please see Kernel Debugging for more information.

# echo 255 >/proc/sys/vserver/debug_switch
Personal tools