lkml.org 
[lkml]   [2007]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: aio is unlikely
On Wed, 09 May 2007 18:06:58 -0400
Jeff Garzik <jeff@garzik.org> wrote:

> > -#define in_aio() !is_sync_wait(current->io_wait)
> > +#define in_aio() (unlikely(!is_sync_wait(current->io_wait)))
>
> Please revert. Workload-dependent "likelihood" should not cause
> programmers to add such markers.
>
> This is a common misunderstanding about unlikely() and likely(). The
> branch prediction used for each assumes 99% unlikely or 99% likely,
> which is not true at all for workload-dependent code.
>
> Even if only 1% of Linux users use AIO, for that 1%, the 'unlikely'
> marker causes repeated branch mispredictions.
>
> likely() and unlikely() should be used for cases where code is
> likely/unlikely for EVERYBODY.

a) disagree with the above

b) if in_aio() ever returns true we do

printk(KERN_ERR "%s(%s:%d) called in async context!\n",
__FUNCTION__, __FILE__, __LINE__);

so I sure hope it's unlikely for all workloads.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-05-10 00:21    [from the cache]
©2003-2011 Jasper Spaans