From mboxrd@z Thu Jan 1 00:00:00 1970 From: rcpilot2010@gmail.com (Abu Rasheda) Date: Mon, 2 May 2011 14:02:34 -0700 Subject: Sleep and Wake up In-Reply-To: <20110502192830.GA21311@kroah.com> References: <20110502192830.GA21311@kroah.com> Message-ID: To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Mon, May 2, 2011 at 12:28 PM, Greg KH wrote: > On Mon, May 02, 2011 at 11:32:32AM -0700, Abu Rasheda wrote: >> I am testing my driver on much faster host processor and facing >> following issues: >> >> My host is too powerful and it can fill up device buffer queue very fast. > > What kind of device is this? its a networking device >> I get best performance when I do busy wait, but this is not desirable >> and is bad design. >> >> I need to sleep and wake up quickly and predictability. Indication >> from device that queue has space, is coming in form of memory write >> (device writes to a memory location of i86 processor). >> >> I tried using wait_event_interruptible_timeout, I am depending on 2nd >> parameter of the function but it wake up is too slow, even tried using >> value of 1. > > Why not try increasing the buffer in your driver to handle any amount of > data needed? Problem come from the fact that remote end can be slow, so device / driver cannot do much. If I increase buffer size, than running on (even) faster host processor will bring back same issue. I am looking for solution which will scale. I check for available buffer size if space is low, I sleep and retry. This is causing lot of CPU to be wasted. How can I optimize this ? > > thanks, > > greg k-h