Difference between revisions of "BC proc entries"
m (Categorized) |
m (UBC is a link) |
||
| Line 1: | Line 1: | ||
| − | This page describes proc interface of [UBC] subsystem. | + | This page describes proc interface of [[[UBC]] subsystem. |
== Old interface == | == Old interface == | ||
Revision as of 12:32, 27 December 2006
This page describes proc interface of [[[UBC]] subsystem.
Old interface
Old interface consisted of 2 (optionally 3) files
user_beancounters- reveals an overall information about resource consumption of each beancounter in system
user_beancounters_sub- reveals information about all beancounters and sub-beancounters in system
user_beancounters_debug- this files is shown if
CONFIG_UBC_DEBUG_KMEMoption is turned on and shows debugging information about each beancounter. This includes the numbers of
- objects charged from each slab
- pages charged
- vmalloc-ed pages
- page beancounters
- etc
New interface
In new interface only user_beancounters entry is left for compatibility with old tools. New entries reside in /proc/bc directory. This directory also contains subdirectories for each beancounter in the system. E.g.
# ls /proc/bc/ 0 ioacct_debug resources # vzctl start 101 ... # ls /proc/bc 0 101 ioacct_debug resources # ls /proc/bc/101/ ioacct kmem_debug resources vmaux
All new entries that are in /proc/bc shows some overall information about BC subsystem, while entries in /proc/bc/$BCID show per-beancounter info.
Existing general entries
/proc/bc/resources- This entry looks like old
user_beancountersentry but
- it doesn't contain “dummy” resources
- if new resource is added to BC it will appear in this entry only
/proc/bc/$BCID/resources- This entry shows the same as
bc/resourcesdoes but for$BCIDbeancounter only. /proc/bc/$BCID/vmaux- This entry shows auxiliary resources used in VM accounting.
/proc/bc/$BCID/kmem_debug- This entry is available with
CONFIG_UBC_DEBUG_KMEMoption set and shows per-beancounter info that was in/proc/user_beancounters_debugbefore.
Kernel API
Subsystems may add its own entries in /proc/bc or /proc/bc/$BCID. To facilitate this the following API is used in BC sybsystem (declared in include/ub/proc.h).
struct proc_dir_entry *bc_proc_root- This is an entry that corresponds to
/proc/bcdirectory. If a subsystem wishes to report some information that is not per-beancounter it may create entry using this as a parent. struct bc_proc_entry;- This describes an entry that may show per-beancounter info. This looks like this:
struct bc_proc_entry {
char *name;
int (*show)(struct seq_file *, void *);
struct bc_proc_entry *next;
};
nameis the entry name as it will appear in/proc/bc/$BCIDshowis a callback that is to fill info about particulat beancounter
void bc_register_proc_entry(struct bc_proc_entry *);- This call registers an entry that shows per-beancounter info.
The code that fills info about BC must look like this
static int bc_my_show(struct seq_file *f, void *v)
{
struct user_beancounter *ub;
ub = seq_beancounter(f);
/* dump info into f here */
return 0;
}
...
static struct bc_proc_entry my_entry = {
.name = "my_entry",
.show = bc_my_show,
};
static int __init bc_my_init(void)
{
bc_register_proc_entry(&my_entry);
return 0;
}
late_initcall(bc_my_init);
Note: Due to limitations in single_open the struct user_beancounter pointer is not passed as void *v into showing function but must be obtained from seq_file with seq_beancounter
|