public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Problems with wait queues
@ 2002-06-26 10:32 Nicolas Bougues
  2002-06-26 10:52 ` Andries Brouwer
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Bougues @ 2002-06-26 10:32 UTC (permalink / raw)
  Cc: linux-kernel

Dear all,

I'm writing a device driver for a PCI board that sends/receives one
frame (80 bytes) of data every 100th/sec. The kernel is 2.4.18 non SMP.

I use the timer task, and every 100th/sec, I transmit any pending
buffer and store the received one, so that it can be handled by the
user mode app.

The driver is accessible using a standard device node.

I implemented a wait queue mechanism in order to deal with blocking
read/writes from user mode. When the dev_write sees the TX queue is
full, it wait_event_interruptible(txq, condition). Idem for RX.

And every 100th/sec, when it gets more data for RX or more room for
TX, it wake_up_interruptible(txq|rxq).

My problem is that I wrote a test app that loops around read() or
write() on my device in user mode, and when running this app, my
loadavg increases, up to 1.00, which is surprising.

But, in the meantime :
- vmstat shows no user mode nor system activity. 
- time of the user mode test app shows 0.00 for both user and
system time.
- a busy task (such as dd if=/dev/zero of=/dev/null bs=1024k
  count=300000) takes the same amount of time to run when the test app
  is running, as it took when the system was idle.

If I insert an usleep(1000*100), which will wait about 1/100th sec,
in the loop around read()/write(), the wait queues aren't used anymore
in the driver (since there is always room for TX or data for RX), and
the loadavg stays at 0.00, which is what is expected.

Does anybody have any idea on what I may have done wrong, and why
would loadavg increase when vmstat show no activity ?

Thanks.
--
Nicolas Bougues


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-06-27 13:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-26 10:32 Problems with wait queues Nicolas Bougues
2002-06-26 10:52 ` Andries Brouwer
2002-06-26 14:00   ` Nicolas Bougues
2002-06-26 14:17     ` Richard B. Johnson
2002-06-26 14:38       ` Nicolas Bougues
2002-06-26 21:49       ` David Woodhouse
2002-06-27 11:44         ` Richard B. Johnson
2002-06-27 12:36           ` Oliver.Neukum
2002-06-27 13:17           ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox