From mboxrd@z Thu Jan 1 00:00:00 1970 From: der.herr@hofr.at (Nicholas Mc Guire) Date: Wed, 20 Jan 2016 15:01:09 +0000 Subject: how to use wait_event_interruptible_timeout with less than 1 jiffie timeout? In-Reply-To: <87a8o0s7nk.fsf@fatcat.parallelwireless> References: <87d1swsrfb.fsf@fatcat.parallelwireless> <20160120082554.GE13776@osadl.at> <87a8o0s7nk.fsf@fatcat.parallelwireless> Message-ID: <20160120150109.GC16707@osadl.at> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Wed, Jan 20, 2016 at 06:57:27PM +0530, Anupam Kapoor wrote: > > >>>>> [2016-01-20T13:55:54+0530]: "Nicholas Mc Guire" (Nicholas): > ,----[ Nicholas ] > | that would still have the same limitation with resepct to time granuarlity > | and as Documentation/timers/ > `---- > ah yes, that's true. > > ,----[ Nicholas ] > | if you really need very short delays then you will need to resort to hrtimers > | (and thus be to some extent config dependent) usleep_range(min, max) is the > | prefered interface in that case. > `---- > any specific reason why schedule_hrtimeout(...) cannot be used ? > It can, but same thing, unless you really need a very specific timeout it is better to pass a range so that the kernel can consolidate the timeout list - so the _range is a system level optimization. so schedule_hrtimeout_range() would be prefered * The @delta argument gives the kernel the freedom to schedule the * actual wakeup to a time that is both power and performance friendly. * The kernel give the normal best effort behavior for "@expires+ at delta", * but may decide to fire the timer earlier, but no earlier than @expires. and you need to convert the timeout to ktime e.g. with ms_to_ktime() thx! hofrat