Re: [PATCH] 2.5.21 - list.h cleanup

Martin Dalecki (dalecki@evision-ventures.com)
Tue, 11 Jun 2002 11:04:16 +0200


> And while I'd like to avoid #include hell, I'm not willing to replace
> inline functions with #define's to avoid it ;^p

A more real example from blk.h:

extern inline struct request *elv_next_request(request_queue_t *q)
{
struct request *rq;

while ((rq = __elv_next_request(q))) {
rq->flags |= REQ_STARTED;

if (&rq->queuelist == q->last_merge)
q->last_merge = NULL;

if ((rq->flags & REQ_DONTPREP) || !q->prep_rq_fn)
break;

/*
* all ok, break and return it
*/
if (!q->prep_rq_fn(q, rq))
break;

/*
* prep said no-go, kill it
*/
blkdev_dequeue_request(rq);
if (end_that_request_first(rq, 0, rq->nr_sectors))
BUG();

end_that_request_last(rq);
}

return rq;
}

The only thing this achvies is kernel bload, since
elv_next_request is:

1. Calling tons of functions, which could be inlined as well.

2. Not precisely on any ultra fast path.

3. Bound by the device speed.

4. Increasing the pressure on branch prediction due
to the while construct.

-
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/