lkml.org 
[lkml]   [2008]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Active waiting with yield()
> * driver unload --- check the count of outstanding requests and call 
> yield() repeatedly until it goes to zero, then unload.

Use a wakeup when the request count hits zero

> * reduced size of data structures (and reduced cache footprint for the hot
> path that actually processes requests)

The CPU will predict the non-wakeup path if that is normal. You can even
make the wakeup use something like

if (exiting & count == 0)

to get the prediction righ

> The downside of yield is slower unloading of the driver by few tens of
> miliseconds, but the user doesn't really care about fractions of a second
> when unloading drivers.

And more power usage, plus extremely rude behaviour when virtualising.

There are cases you have to use cpu_relax/spins or yield simply because
the hardware doesn't feel like providing interrupts when you need them,
but for the general case its best to use proper sleeping.

Remember also you can use a single wait queue for an entire driver for
obscure happenings like unloads.

Alan



\
 
 \ /
  Last update: 2008-11-14 20:09    [W:0.055 / U:1.628 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site