Re: Strange delay on PCI-DMA-transfer completion bywait_event_interruptible()

From: Robert Hancock
Date: Tue Dec 13 2005 - 21:13:12 EST


linux-os (Dick Johnson) wrote:
Every time somebody wants to rewrite a macro, they declare that the
previous one had some race condition. If, in fact, you have only
one DMA occurring from your device then no race is possible with
interruptible_sleep_on(). wait_event_interruptible() is the same thing
but with an additional access to some memory variable, possibly
causing a cache refill which means it might take more time.

This is not correct. Using interruptible_sleep_on, there is no way to prevent the race where the condition being waited on happens between the test to see if it has become true and calling interruptible_sleep_on. wait_event_interruptible puts the caller into the wait queue before testing the condition, which prevents the race.

interruptible_sleep_on is, with good reason, no longer recommended for use.

--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@xxxxxxxxxxxxx
Home Page: http://www.roberthancock.com/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/