All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dhaval Giani <dhaval@linux.vnet.ibm.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>, Ingo Molnar <mingo@elte.hu>
Cc: Bharata B Rao <bharata@linux.vnet.ibm.com>,
	Balbir Singh <balbir@in.ibm.com>,
	Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>,
	Gautham Shenoy <ego@in.ibm.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] sched: rt group scheduling, compare child's limit against parent's
Date: Fri, 27 Mar 2009 21:49:15 +0530	[thread overview]
Message-ID: <20090327161915.GA8891@linux.vnet.ibm.com> (raw)

Hi Ingo, Peter,

I've not been able to follow the reasoning behind checking the sum of
the children's runtime not exceeding the parent's runtime as opposed to
the child's runtime not exceeding that of the parent.

>From what I understand, the limits only guarantee that the group cannot
exceed a certain limit and not guarantee a group gets to run. If my
understanding is corrct, maybe the following patch is needed?

Thanks,

--
sched: rt group scheduling, compare child's limit against parent's

The current logic checks that the sum of the children's runtime in rt
group scheduling does not exceed the parent's. This logic is wrong,
all we claim is that the group cannot exceed the amount of time allowed.

Change the code to reflect this.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
---
 kernel/sched.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -9601,7 +9601,7 @@ static int tg_schedulable(struct task_gr
 {
 	struct rt_schedulable_data *d = data;
 	struct task_group *child;
-	unsigned long total, sum = 0;
+	unsigned long total;
 	u64 period, runtime;
 
 	period = ktime_to_ns(tg->rt_bandwidth.rt_period);
@@ -9640,9 +9640,10 @@ static int tg_schedulable(struct task_gr
 		return -EINVAL;
 
 	/*
-	 * The sum of our children's runtime should not exceed our own.
+	 * The child's runtime should not exceed our own.
 	 */
 	list_for_each_entry_rcu(child, &tg->children, siblings) {
+		unsigned long ratio;
 		period = ktime_to_ns(child->rt_bandwidth.rt_period);
 		runtime = child->rt_bandwidth.rt_runtime;
 
@@ -9651,11 +9652,11 @@ static int tg_schedulable(struct task_gr
 			runtime = d->rt_runtime;
 		}
 
-		sum += to_ratio(period, runtime);
-	}
+		ratio = to_ratio(period, runtime);
 
-	if (sum > total)
-		return -EINVAL;
+		if (ratio > total)
+			return -EINVAL;
+	}
 
 	return 0;
 }
-- 
regards,
Dhaval

             reply	other threads:[~2009-03-27 16:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-27 16:19 Dhaval Giani [this message]
2009-03-27 16:23 ` [PATCH] sched: rt group scheduling, compare child's limit against parent's Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090327161915.GA8891@linux.vnet.ibm.com \
    --to=dhaval@linux.vnet.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=balbir@in.ibm.com \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=ego@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=vatsa@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.