kvm_read() vs ioctl performance

Poul-Henning Kamp phk at phk.freebsd.dk
Sat Mar 22 06:32:23 PDT 2008


In message <416202.18656.qm at web63914.mail.re1.yahoo.com>, Barney Cordoba writes
:

>I can't easily follow this driver, given the superior
>comments :) 

Look at the mmap() function.

>My concern is this: stats may be updated in iterations
>of 100K+ times per second, while stats are only
>gathered once every few seconds. Even a tiny addition
>to the kernel cpu cycles can make it a "cut off your
>head to stop a nosebleed" scenario. I don't want to
>lose cpu cycles for the sake of saving a fraction of a
>ms every few minutes.

The point about using shared memory, is that it is just
that: shared memory.

The memory the kernel writes to, is the same memory the
userland reads from.

There is _no_ overhead anywhere.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-current mailing list