On Thu, Aug 11, 2005 at 05:20:53AM -0500, Robert W. Fuller wrote:
...
| Yes, I can kmem_alloc the condition variable.  However, I'm only using it for
| the duration of a thread wait.  In this case, it's in the read entry point of 
a
| character device.  I don't want to incur the cost of calling a sub allocator,
| both in terms of processor time and memory fragmentation for something this
| trivial.  I know that after the wait, the condition variable will not be used 
again.

Kernel stacks are pageable, but only when the thread is not running or
blocked in the kernel.

However, just because it would work doesn't mean it's good software engineering
practice. :)

This sort of state would normally be kept in the driver soft state structure,
and so would be allocated at the attach and torn down in detach.  Is there some
reason you can't keep this cv in your soft state?  If not, the overhead of
kmem_alloc() is going to be very small -- a typical kmem_alloc() is on the
order of three memory references.  It takes 10-100x longer to go to sleep
and wake up, so the allocation/free will be in the noise.

In summary, if the overhead of kmem_alloc() would be too much, AND you can't
keep this in some persistent store like your per-instance soft state, then I
would think there is a higher level design issue with the driver that needs
re-thinking.

- Eric

_______________________________________________
opensolaris-code mailing list
[email protected]
https://opensolaris.org:444/mailman/listinfo/opensolaris-code

Reply via email to