tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] a character device counting kernel pages




On Aug 14, 2008, at 7:00 AM, Ilya Dogolazky wrote:

The concept is good, but the use of mdpage is machine-dependent and PVF_KMPAGE is arm-specific. Walking all the pages to keep the count is not correct.
Instead, I've added a sysctl node to pmap.c (machdep.kmpages) which will
return the number of pages with PMAP_KMPAGE set.

the attached patch is implementing a simple counter of memory pages used by
the kernel.

This kernel memory consumption measuring device (/dev/kp0, major=239, minor=0)
is reporting (in decimal form, useful for shell scripts) the number of
physical memory pages used by the kernel itself. It is tested for ARM only, but will probably work with some other architectures too. To enable it add the line "pseudo-device pagecounter" to the config file and create the device node
(mknod /dev/kp0 c 239 0).

Usage in a shell script: KERNEL_MEM=$(cat /dev/kp0)

Any comment and suggestions are welcome.

Now you can do sysctl -n machdep.kmpages


Home | Main Index | Thread Index | Old Index