On Saturday 18 March 2006 00:26, Nick Piggin wrote:
Con Kolivas wrote:
-static inline void __activate_task(task_t *p, runqueue_t *rq)
+static void __activate_task(task_t *p, runqueue_t *rq)
{
- enqueue_task(p, rq->active);
+ if (batch_task(p))
+ enqueue_task(p, rq->expired);
+ else
+ enqueue_task(p, rq->active);
inc_nr_running(p, rq);
}
I prefer:
prio_array_t *target = rq->active;
if (batch_task(p))
target = rq->expired;
enqueue_task(p, target);
Because gcc can use things like predicated instructions for it.
But perhaps it is smart enough these days to recognise this?
At least in the past I have seen it start using cmov after doing
such a conversion.
At any rate, I think it looks nicer as well. IMO, of course.
Well on my one boring architecture here is a before and after, gcc 4.1.0 with optimise for size kernel config:
I'm not attached to the style, just the feature. If you think it's warranted I'll change it.