On Thu, Mar 30, 2017 at 4:19 PM, Samuel Thibault <samuel.thibault@xxxxxxxxxxxx> wrote: > Hello, > > Okash Khawaja, on jeu. 30 mars 2017 15:45:08 +0100, wrote: >> - in spk_ttyio_in: >> - countdown for SPK_SERIAL_TIMEOUT usecs - similar to >> spk_serial_in - and check for atomic_read(&buf_free) == 0 > > Such busy polling will be way less acceptable than down_timeout :) > And all the more so since it does not actually try to give CPU to the > part of the kernel which will provide the character, while down_timeout > exactly does that. Of course. I misread the code in down_timeout() which uses spinlock which made me think it's busy waiting. > >> seems to be a somewhat less acceptance for timeout while acquiring >> locks. For example in case of mutex_lock_timeout: >> http://lkml.iu.edu/hypermail/linux/kernel/0611.3/0254.html. > > Here we are not acquiring a lock: the down_timeout call is used to > try to consume a character Yes I can see now that we utilise waiting feature of semaphore here. Thanks, Okash _______________________________________________ Speakup mailing list Speakup@xxxxxxxxxxxxxxxxx http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup