Re: [PATCH V2] sched: fix autogroup nice tune on UP

From: Yong Zhang
Date: Mon Jan 24 2011 - 01:11:37 EST


On Mon, Jan 24, 2011 at 1:54 PM, Pekka Enberg <penberg@xxxxxxxxxx> wrote:
> On Mon, Jan 24, 2011 at 7:40 AM, Yong Zhang <yong.zhang0@xxxxxxxxx> wrote:
>> +static void update_cfs_shares(struct cfs_rq *cfs_rq, long weight_delta)
>> +{
>> + Â Â Â struct task_group *tg;
>> + Â Â Â struct sched_entity *se;
>> +
>> + Â Â Â if (!cfs_rq)
>> + Â Â Â Â Â Â Â return;
>> +
>> + Â Â Â tg = cfs_rq->tg;
>> + Â Â Â se = tg->se[0];
>> + Â Â Â if (!se)
>> + Â Â Â Â Â Â Â return;
>> + Â Â Â if (likely(se->load.weight == tg->shares))
>> + Â Â Â Â Â Â Â return;
>> + Â Â Â reweight_entity(cfs_rq_of(se), se, tg->shares);
>> +}
>
> Wouldn't it be cleaner if we'd separate the shares calculation in a
> separate helper function that's just
>
> Âreturn tg->shares;

I'm not sure I get your point correctly.
You mean the two tg->shares above, right?

If so, yeah, we can declare a variable for that.

>
> for UP and extract the current logic for the SMP version?
>

This is the UP specific version, I don't touch SMP version.
On SMP, update_cfs_shares() is more complex.

Thanks,
Yong


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