Re: kvm_read() vs ioctl performance



Barney Cordoba wrote:
--- Julian Elischer <julian@xxxxxxxxxxxx> wrote:

Barney Cordoba wrote:
--- Julian Elischer <julian@xxxxxxxxxxxx> 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.
cool..
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.

The app is portable, and I'd prefer not to have
different methods for LINUX and FreeBSD. When you say
"coherent", what exactly do you mean?

there is no synchronisation between your app and the device.
I dont know what sized structure you are reading but how do you know that the device isn't half way through writing it?

A mmapped page would be more portable,
for example done in the way that a video frame buffer is done.
All systems support that sort of semantic the same.
Then you can use memory semaphores to make sure that the stuff is consistent, because you can write back.




Barney


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

_______________________________________________
freebsd-current@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: kvm_read() vs ioctl performance
    ... overhead, assuming that the ioctl call is to a ... tried a shared memory page? ... (which is why a shared page might give the same result with a stable API which is not libkvm... ...
    (freebsd-current)
  • Re: kvm_read() vs ioctl performance
    ... overhead, assuming that the ioctl call is to a ... stable API which is not libkvm... ...
    (freebsd-current)
  • Re: 2.6, 3.0, and truly independent intepreters
    ... keyboard of Rhamphoryncus: ... designers of Python would have added the GIL anyway. ... It is not clear to me that with the use of shared memory between processes, ... shared memory blocks is harder to write and has more overhead than the code ...
    (comp.lang.python)
  • Re: Dont receive IRP_MJ_CREATE on a CreateFile
    ... irps, the FS will. ... I can't rely on a "release" IOCTL because ... Welcome to one of the many reasons not to use shared memory. ... Don Burn (MVP, Windows DDK) ...
    (microsoft.public.development.device.drivers)
  • Re: Dont receive IRP_MJ_CREATE on a CreateFile
    ... shared memory use an IOCTL, to communicate, then you will recieve a cancel ... problems (besides process termination notification) you can use an IOCTL ... the buffer passed in is "the shared memory region" you use to communicate. ...
    (microsoft.public.development.device.drivers)