[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1302010100.2225.1333.camel@twins>
Date: Tue, 05 Apr 2011 15:28:20 +0200
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Paul Turner <pjt@...gle.com>
Cc: linux-kernel@...r.kernel.org,
Bharata B Rao <bharata@...ux.vnet.ibm.com>,
Dhaval Giani <dhaval.giani@...il.com>,
Balbir Singh <balbir@...ux.vnet.ibm.com>,
Vaidyanathan Srinivasan <svaidy@...ux.vnet.ibm.com>,
Srivatsa Vaddagiri <vatsa@...ibm.com>,
Kamalesh Babulal <kamalesh@...ux.vnet.ibm.com>,
Ingo Molnar <mingo@...e.hu>,
Pavel Emelyanov <xemul@...nvz.org>,
Nikhil Rao <ncrao@...gle.com>
Subject: Re: [patch 04/15] sched: throttle cfs_rq entities which exceed
their local quota
On Tue, 2011-03-22 at 20:03 -0700, Paul Turner wrote:
> @@ -1249,6 +1257,9 @@ entity_tick(struct cfs_rq *cfs_rq, struc
> */
> update_curr(cfs_rq);
>
> + /* check that entity's usage is still within quota (if enabled) */
> + check_cfs_rq_quota(cfs_rq);
> +
> /*
> * Update share accounting for long-running entities.
> */
You already have a hook in update_curr() to account quota, why not also
use that to trigger the reschedule? request_cfs_rq_quota() already has
the information we failed to replenish the local quota.
Then when you've gotten rid of check_cfs_rq_quota() there isn't a second
user of within_bandwidth() and you can fold:
> @@ -1230,6 +1233,9 @@ static void put_prev_entity(struct cfs_r
> if (prev->on_rq)
> update_curr(cfs_rq);
>
> + if (!within_bandwidth(cfs_rq))
> + throttle_cfs_rq(cfs_rq);
> +
> check_spread(cfs_rq, prev);
> if (prev->on_rq) {
> update_stats_wait_start(cfs_rq, prev);
Into a single hook.
> @@ -1447,10 +1544,15 @@ static void dequeue_task_fair(struct rq
> for_each_sched_entity(se) {
> cfs_rq = cfs_rq_of(se);
> dequeue_entity(cfs_rq, se, flags);
> -
> + /* end evaluation on throttled cfs_rq */
> + if (cfs_rq_throttled(cfs_rq)) {
> + se = NULL;
> + break;
> + }
> /* Don't dequeue parent if it has other entities besides us */
> if (cfs_rq->load.weight)
> break;
> + check_cfs_rq_quota(cfs_rq);
> flags |= DEQUEUE_SLEEP;
> }
dequeue_entity() calls update_curr(), so again, by folding
check_cfs_rq_quota() into your update_curr() hook this becomes simpler.
> +static inline int throttled_hierarchy(struct cfs_rq *cfs_rq)
> +{
> + struct task_group *tg;
> + struct sched_entity *se;
> +
> + if (cfs_rq_throttled(cfs_rq))
> + return 1;
> +
> + tg = cfs_rq->tg;
> + se = tg->se[cpu_of(rq_of(cfs_rq))];
> + if (!se)
> + return 0;
> +
> + for_each_sched_entity(se) {
> + if (cfs_rq_throttled(cfs_rq_of(se)))
> + return 1;
> + }
> +
> + return 0;
> +}
You can actually call for_each_sched_entity() with se==NULL, saves a few lines.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists