Re: [PATCH] sched: activate SCHED BATCH expired

Nick Piggin
2006-03-17T13:46:12Z

Con Kolivas wrote:
> 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.
>

I guess it isn't doing the cmov because it doesn't want to do the
extra load in the common case, which is fair enough (are you compiling
for a pentiumpro+, without generic x86 support? what about if you
turn off optimise for size?)

At least other archtectures might be able to make better use of it,
and I agree even for i386 the code looks better (and slightly smaller).

--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com