public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Bougues <nbougues-listes@axialys.net>
To: unlisted-recipients:; (no To-header on input)
Cc: linux-kernel@vger.kernel.org
Subject: Problems with wait queues
Date: Wed, 26 Jun 2002 12:32:43 +0200	[thread overview]
Message-ID: <20020626103243.GA4797@kiwi> (raw)

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


             reply	other threads:[~2002-06-26 10:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-26 10:32 Nicolas Bougues [this message]
2002-06-26 10:52 ` Problems with wait queues 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020626103243.GA4797@kiwi \
    --to=nbougues-listes@axialys.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox