lkml.org 
[lkml]   [2008]   [Nov]   [19]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Active waiting with yield()
FromPeter Zijlstra <>
DateWed, 19 Nov 2008 17:14:21 +0100
On Tue, 2008-11-18 at 12:11 -0500, Mikulas Patocka wrote:
> On Tue, 18 Nov 2008, Alan Cox wrote:
> 
> > > You will touch the wait queue always when finishing the last pending 
> > > request --- just to find out that there is no one waiting on it.
> > 
> > Why ? If my fast path for this something like
> > 
> > 	if (unlikely(foo->unload_pending) && count == 0)
> > 		wake_up(..)
> > 
> > chances are that I can put unload_pending somewhere in a cache line with
> > other stuff (certainly for L2) and it will get predicted well.
> 
> This makes a code branch that is very rarely tested and a potential bug. 
> Every such rarely executed branch is a danger and even a silly typo in the 
> code can hide there for many years without being noticed.

If you cannot get these simple things right, and stubbornly refuse to
listen to people telling you to the kernel is not the place to cut
corners, perhaps you should not be doing kernel code.




\
 
 \ /
  Last update: 2008-11-19 17:17    [from the cache]
©2003-2008