Re: [PATCH v3 2/7] sched: accumulate per-cfs_rq cpu usage

From: Nikhil Rao
Date: Wed Oct 13 2010 - 10:42:15 EST


On Wed, Oct 13, 2010 at 6:59 AM, Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> wrote:
> * Nikhil Rao <ncrao@xxxxxxxxxx> [2010-10-13 06:46:18]:
>
>> > Quick question for cfs_b->quota == RUNTIME_INF, won't cfs_b->runtime
>> > be always > 0?
>>
>> Hi Balbir,
>>
>> cfs_b->runtime can be 0 if the task group exhausts its quota.
>> cfs_b->runtime is a counter that is periodically refreshed to
>> cfs_b->quota, and is decremented every time a cfs_rq requests a slice.
>>
>
> Thanks, Nikhil
>
> I saw several checks for quota == RUNTIME_INF and saw updates not
> happening. Do we track usage for cgroups with infinite quota? IOW, is
> runtime updated? If so, why?
>

We don't track usage or update runtime for cgroups with infinite
quota. Most of these RUNTIME_INF checks are usually at the top of the
functions and return immediately. The checks in the middle of
functions are mostly to prevent races when cfs_b->quota is updated.

And ... I think I might have misunderstood your original question. Let
me try answering that again. We check for quota == RUNTIME_INF (in
addition to cfs_b->runtime > 0) because it is possible that the global
pool is updated to RUNTIME_INF between the quota check in
account_cfs_rq_quota() and when the actual quota is distributed in
tg_request_cfs_quota(). I hope that answers your original question.

-Thanks,
Nikhil

> --
> Â Â Â ÂThree Cheers,
> Â Â Â ÂBalbir
>
--
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/