kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* how to use wait_event_interruptible_timeout with less than 1 jiffie timeout?
@ 2016-01-19 19:51 Daniel.
  2016-01-20  6:20 ` Anupam Kapoor
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel. @ 2016-01-19 19:51 UTC (permalink / raw)
  To: kernelnewbies

Hi everybody,

I have some code that convert an timeout comming from userspace (in
ms) to jiffies prior passing to wait_event_interrupitible_timeout().
The code looks like this:

unsigned long tout = user.timeout * HZ / 1000; /* convert from ms to jiffie */
int status = wait_event_interruptible_timeout(wq, cond, tout);

I'm using HZ=100, the known default.
The problem is: with HZ = 100 and user.timeout = 10 I have:
10 * 100 / 1000 = 1,

This means that I can't use timeouts with less than 10ms. Is there any
way to circunvent this without changing HZ value?

Now let me explain why. I have a protocol running on linux that talk
to other embedded systems in an master-slave way. This communication
goes through some RF hardware. The communication is maded by master
transmitting a frame and receiving another frame from slave. The slave
takes about 2 ms to reply, but if the transmitting failed (because the
slave was not listening or because the frame was corrupted while
traveling through the air) the server has to transmit it again. Today
I'm using 10ms as timeout because is the smaller amount that I known
how to use, but if I can decrease this timeout to 2 or 3ms I would
have a better performance in case of failures.

Best regards,

-- 
"Do or do not. There is no try"
  Yoda Master

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

end of thread, other threads:[~2016-01-20 15:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-19 19:51 how to use wait_event_interruptible_timeout with less than 1 jiffie timeout? Daniel.
2016-01-20  6:20 ` Anupam Kapoor
2016-01-20  8:25   ` Nicholas Mc Guire
2016-01-20 13:27     ` Anupam Kapoor
2016-01-20 15:01       ` Nicholas Mc Guire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).