6,534
edits
Changes
→New interface: use full file names, i.e. add /proc/ to some of them; use source tag; formatting; punctuation
== 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.
<pre>
# ls /proc/bc/
=== Existing general entries ===
; <code>/proc/bc/resources</code>
: This entry looks like old <code>/proc/user_beancounters</code> entry but:# it doesn't contain “dummy” resources:# if new resource is added to BC it will appear in this entry only
; <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.
; <code>/proc/bc/$BCID/vmaux</code>
: This entry shows auxiliary resources used in VM accounting.
=== Other entries ===
The following subsystems add their own entries in <code>/proc/bc</code> and <code>/proc/bc/$BCID</code>:
* [[IO accounting]]
; <code>struct bc_proc_entry;</code>
: This describes an entry that may show per-beancounter info. This looks like this:
<presource lang="c">
struct bc_proc_entry {
char *name;
struct bc_proc_entry *next;
};
</presource>
* <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
: This call registers an entry that shows per-beancounter info.
The code that fills info about BC must look like this:<presource lang="c">
static int bc_my_show(struct seq_file *f, void *v)
{
late_initcall(bc_my_init);
</presource>
{{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]]