kvm_read() vs ioctl performance

Julian Elischer julian at elischer.org
Fri Mar 21 18:53:07 PDT 2008

Barney Cordoba wrote:
> --- Julian Elischer <julian at elischer.org> wrote:
>> Barney Cordoba wrote:
>>> I have an app which reads stats from the kernel
>>> periodically, and there can be a lot of
>> iterations,
>>> sometimes 20,000 or more. I'm thinking of
>> converting
>>> from an ioctl method to kvm_read(). KVM is
>> certainly
>>> simpler, but its not clear what overhead is
>> involved,
>>> since kvm_read() likely has to call the kernel
>> also.
>>> Does anyone have a handle on the difference in
>>> overhead, assuming that the ioctl call is to a
>> module
>>> which does nothing more than copy the data and
>> return?
>> tried a shared memory page?
> No, but I built a test and kvm_read is 70 times
> faster, in
> case anyone is interested.

the only downside is that we are trying to get away from kvm direct 
access. (which is why a shared page might give the same result with a 
stable API which is not libkvm... BTW on an SMP machine you have
no way to ensure that your stats are coherent if you use libkvm.

> Barney
>       ____________________________________________________________________________________
> Never miss a thing.  Make Yahoo your home page. 
> http://www.yahoo.com/r/hs

More information about the freebsd-current mailing list