All of lore.kernel.org
 help / color / mirror / Atom feed
* yield() and cond_resched() do not yield to another thread
@ 2018-09-04 13:16 fei phung
  2018-09-05  7:10 ` Stephen Hemminger
  2018-09-05  7:11 ` Stephen Hemminger
  0 siblings, 2 replies; 3+ messages in thread
From: fei phung @ 2018-09-04 13:16 UTC (permalink / raw)
  To: driverdev-devel

Hi everyone,

I am working on https://github.com/promach/riffa/tree/full_duplex

While I modifying the linux driver, I faced some issue using yield().

Why riffa_driver.c yield() function
https://gist.github.com/promach/7716ee8addcaa33fda140d74d1ad94d6#file-riffa_driver-c-L746

does not yield to chnl_send() thread
https://gist.github.com/promach/7716ee8addcaa33fda140d74d1ad94d6#file-riffa_driver-c-L883
?

See https://stackoverflow.com/questions/52166325/why-yield-and-cond-resched-do-not-yield-to-another-thread
for more details
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: yield() and cond_resched() do not yield to another thread
  2018-09-04 13:16 yield() and cond_resched() do not yield to another thread fei phung
@ 2018-09-05  7:10 ` Stephen Hemminger
  2018-09-05  7:11 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2018-09-05  7:10 UTC (permalink / raw)
  To: fei phung; +Cc: driverdev-devel

On Tue, 4 Sep 2018 21:16:07 +0800
fei phung <feiphung27@gmail.com> wrote:

> Hi everyone,
> 
> I am working on https://github.com/promach/riffa/tree/full_duplex
> 
> While I modifying the linux driver, I faced some issue using yield().
> 
> Why riffa_driver.c yield() function
> https://gist.github.com/promach/7716ee8addcaa33fda140d74d1ad94d6#file-riffa_driver-c-L746
> 
> does not yield to chnl_send() thread
> https://gist.github.com/promach/7716ee8addcaa33fda140d74d1ad94d6#file-riffa_driver-c-L883
> ?
> 
> See https://stackoverflow.com/questions/52166325/why-yield-and-cond-resched-do-not-yield-to-another-thread
> for more details
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Using yield in modern code is almost always wrong. It has priority inversion and latency
issues. You are much better off using a real syncronization primitive (like completion or wait).
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: yield() and cond_resched() do not yield to another thread
  2018-09-04 13:16 yield() and cond_resched() do not yield to another thread fei phung
  2018-09-05  7:10 ` Stephen Hemminger
@ 2018-09-05  7:11 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2018-09-05  7:11 UTC (permalink / raw)
  To: fei phung; +Cc: driverdev-devel

On Tue, 4 Sep 2018 21:16:07 +0800
fei phung <feiphung27@gmail.com> wrote:

> Hi everyone,
> 
> I am working on https://github.com/promach/riffa/tree/full_duplex
> 
> While I modifying the linux driver, I faced some issue using yield().
> 
> Why riffa_driver.c yield() function
> https://gist.github.com/promach/7716ee8addcaa33fda140d74d1ad94d6#file-riffa_driver-c-L746
> 
> does not yield to chnl_send() thread
> https://gist.github.com/promach/7716ee8addcaa33fda140d74d1ad94d6#file-riffa_driver-c-L883
> ?
> 
> See https://stackoverflow.com/questions/52166325/why-yield-and-cond-resched-do-not-yield-to-another-thread
> for more details
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-05  7:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-04 13:16 yield() and cond_resched() do not yield to another thread fei phung
2018-09-05  7:10 ` Stephen Hemminger
2018-09-05  7:11 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.