Re: timeout of 10 usecs

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

 



El Mon, Mar 16, 2009 at 01:03:35PM +0300 Denis Borisevich ha dit:

> 2009/3/16 Razvan Deaconescu <razvan@xxxxxxxxxxxxxxxxxx>:
> > On Mon, 2009-03-16 at 00:41 +0300, Denis Borisevich wrote:
> >> Hi!
> >> Is there any way to achieve a timeout of say 10 usecs in kernel module?
> >
> > See udelay[1]. Please note that it does busy-waiting (you can't
> > block/put to sleep the current process for periods less than 1000/HZ
> > milliseconds).
> >
> > Razvan
> >
> > [1] http://lxr.linux.no/linux+v2.6.28.7/arch/x86/include/asm/delay.h#20
> 
> 
> Hmm..busy-wait is not good for my situation. Is there any way to
> achieve these little timeouts with RT_PREEMPT patch?

user space processes can use nanosleep() for sleeping for short times,
though the kernel only guarantees that the process will sleep *at
least* the specified time. the implementation of nanosleep() uses
hrtimer_nanosleep() to achieve this, maybe you could try something
similar:

http://lxr.linux.no/linux+v2.6.28/kernel/hrtimer.c#L1632

10 usecs is a very short time for sleeping, i'm not sure if the kernel
can provide this granularity. probably your task needs to have rt
priority to be re-scheduled after such a short period.

ftrace (Documentation/ftrace.txt) can be useful to determine whether
the real sleep time is near to the period you pretend.

-- 
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona


 Someone has said that it requires less mental effort to condemn than to think
                             (Emma Goldman)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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