Open main menu

OpenVZ Virtuozzo Containers Wiki β

Editing BC proc entries

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
{{UBC toc}}
 
 
This page describes proc interface of [[UBC]] subsystem.
 
This page describes proc interface of [[UBC]] subsystem.
  
 
== Old interface ==
 
== Old interface ==
The [[Proc/user_beancounters|old interface]] consisted of 2 (optionally 3) files:
+
[[Proc/user_beancounters|Old interface]] consisted of 2 (optionally 3) files
; <code>/proc/user_beancounters</code>
+
; <code>user_beancounters</code>
: reveals an overall information about resource consumption of each beancounter in system; described [[Proc/user_beancounters|here]];
+
: reveals an overall information about resource consumption of each beancounter in system
; <code>/proc/user_beancounters_sub</code>
+
; <code>user_beancounters_sub</code>
: reveals information about all beancounters and sub-beancounters in system;
+
: reveals information about all beancounters and sub-beancounters in system
; <code>/proc/user_beancounters_debug</code>
+
; <code>user_beancounters_debug</code>
: shows debugging information about each beancounter. Available if <code>CONFIG_UBC_DEBUG_KMEM</code> option is turned on. Information revealed includes the numbers of
+
: this files is shown if <code>CONFIG_UBC_DEBUG_KMEM</code> option is turned on and shows debugging information about each beancounter. This includes the numbers of
:# objects charged from each slab;
+
# objects charged from each slab
:# pages charged;
+
# pages charged
:# vmalloc-ed pages;
+
# vmalloc-ed pages
:# page beancounters;
+
# page beancounters
:# etc.
+
# etc
  
 
== New interface ==
 
== New interface ==
In new interface only <code>/proc/user_beancounters</code> entry is left for compatibility with old tools. New entries reside in <code>/proc/bc</code> directory. This directory also contains subdirectories for each beancounter in the system. E.g.
+
In new interface only <code>user_beancounters</code> entry is left for compatibility with old tools. New entries reside in <code>/proc/bc</code> directory. This directory also contains subdirectories for each beancounter in the system. E.g.
 
<pre>
 
<pre>
 
# ls /proc/bc/
 
# ls /proc/bc/
Line 33: Line 32:
 
=== Existing general entries ===
 
=== Existing general entries ===
 
; <code>/proc/bc/resources</code>
 
; <code>/proc/bc/resources</code>
: This entry looks like old <code>/proc/user_beancounters</code> entry but
+
: This entry looks like old <code>user_beancounters</code> entry but
:# it doesn't contain “dummy” resources
+
# it doesn't contain “dummy” resources
:# if new resource is added to BC it will appear in this entry only
+
# if new resource is added to BC it will appear in this entry only
 
; <code>/proc/bc/$BCID/resources</code>
 
; <code>/proc/bc/$BCID/resources</code>
: This entry shows the same as <code>/proc/bc/resources</code> does but for <code>$BCID</code> beancounter only.
+
: This entry shows the same as <code>bc/resources</code> does but for <code>$BCID</code> beancounter only.
 
; <code>/proc/bc/$BCID/vmaux</code>
 
; <code>/proc/bc/$BCID/vmaux</code>
 
: This entry shows auxiliary resources used in VM accounting.
 
: This entry shows auxiliary resources used in VM accounting.
Line 44: Line 43:
  
 
=== Other entries ===
 
=== Other entries ===
The following subsystems add their own entries in <code>/proc/bc</code> and <code>/proc/bc/$BCID</code>:
+
The following subsystems add their own entries in <code>/proc/bc</code> and <core>/proc/bc/$BCID</code>
* [[IO accounting]]
+
* [[IO_accounting]]
  
 
=== Kernel API ===
 
=== Kernel API ===
Line 53: Line 52:
 
; <code>struct bc_proc_entry;</code>
 
; <code>struct bc_proc_entry;</code>
 
: This describes an entry that may show per-beancounter info. This looks like this:
 
: This describes an entry that may show per-beancounter info. This looks like this:
<source lang="c">
+
<pre>
 
struct bc_proc_entry {
 
struct bc_proc_entry {
 
         char *name;
 
         char *name;
Line 59: Line 58:
 
         struct bc_proc_entry *next;
 
         struct bc_proc_entry *next;
 
};
 
};
</source>
+
</pre>
 
* <code>name</code> is the entry name as it will appear in <code>/proc/bc/$BCID</code>
 
* <code>name</code> is the entry name as it will appear in <code>/proc/bc/$BCID</code>
 
* <code>show</code> is a callback that is to fill info about particulat beancounter
 
* <code>show</code> is a callback that is to fill info about particulat beancounter
Line 65: Line 64:
 
: This call registers an entry that shows per-beancounter info.
 
: This call registers an entry that shows per-beancounter info.
  
The code that fills info about BC must look like this:
+
The code that fills info about BC must look like this
<source lang="c">
+
<pre>
 
static int bc_my_show(struct seq_file *f, void *v)
 
static int bc_my_show(struct seq_file *f, void *v)
 
{
 
{
Line 88: Line 87:
  
 
late_initcall(bc_my_init);
 
late_initcall(bc_my_init);
</source>
+
</pre>
 
{{note|Due to limitations in <code>single_open</code> the <code>struct user_beancounter</code> pointer is not passed as <code>void *v</code> into showing function but must be obtained from <code>seq_file</code> with <code>seq_beancounter</code>}}
 
{{note|Due to limitations in <code>single_open</code> the <code>struct user_beancounter</code> pointer is not passed as <code>void *v</code> into showing function but must be obtained from <code>seq_file</code> with <code>seq_beancounter</code>}}
 +
 +
[[Category:UBC]]

Please note that all contributions to OpenVZ Virtuozzo Containers Wiki may be edited, altered, or removed by other contributors. If you don't want your writing to be edited mercilessly, then don't submit it here.
If you are going to add external links to an article, read the External links policy first!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Templates used on this page: