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 Thu, 14 Aug 2008 16:35:41 +0200
Quentin Garnier <cube%cubidou.net@localhost> wrote:

> On Thu, Aug 14, 2008 at 05:00:59PM +0300, Ilya Dogolazky wrote:
> > Hi,
> > 
> > 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)
> 
> Heh, that's so Linux.  We BSDers prefer sysctl for that kind of stuff.
> So I'd say it's the wrong approach for the interface (look at it that
> way: sysctl is one, maybe two syscalls, cat /dev/kp0 is at least 4).
> 
Or make it part of kernfs, which we already have.  (I'm not concerned
about the number of system calls; this isn't the sort of thing that's
being done inside of an inner loop.  A bigger issue is code cleanliness
and usability.)


                --Steve Bellovin, http://www.cs.columbia.edu/~smb


Home | Main Index | Thread Index | Old Index