Re: Trying to make kernel thread sleep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/28/06, Ricard Wanderlof <ricard.wanderlof@xxxxxxxx> wrote:

On Mon, 28 Aug 2006, Nish Aravamudan wrote:

>> On Sun, 27 Aug 2006, Nish Aravamudan wrote:
>> > *sleep_on* are deprecated and racy.
> http://lwn.net/Articles/68118/
>

Thanks for the reference.

One would expect that if the only goal is to wait for a period of
time, then calls such as
interruptible_sleep_on(&my_wait);
should be ok, no? (Why one would do that is another issue of course;
normally there is some condition to be met to break the sleep.)

As Bora mentions, wait-queues are a heavy-handed way to only sleep for
a certain amount of time, that's what
schedule_timeout_{un,}interruptible, msleep{,interruptible} are for.

There also seem to be a bunch of calls to fix the situation in the
article, such as wait_event_timeout() which seem include both a timeout
and a condition that must be met. Don't know when they were introduced.

For example:
wait_event_timeout( wq, flag != 0, sleep_jiffies);
wait_event_interruptible( wq, flag != 0 );

Yup, I sent a number of cleanups for the remaining callers of
*sleep_on* (converting what I could to wait_event*) to the KJ list a
while back, I'll try and refresh that stack sometime soon.

I also recently sent a patch to KJ for a new interface, called
poll_event() which uses schedule_timeout() for loop'ing rather than a
wait-queue.

Thanks,
Nish

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux