public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Mark Glines <mark@glines.org>
Cc: Ingo Molnar <mingo@elte.hu>, L-K <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.28 has unconfigurable group sched?
Date: Wed, 14 Jan 2009 10:56:32 +0100	[thread overview]
Message-ID: <1231926992.7141.23.camel@twins> (raw)
In-Reply-To: <496CDDE9.3050008@glines.org>

On Tue, 2009-01-13 at 10:31 -0800, Mark Glines wrote:
> Hi,
> 
> I've got an issue on x86-64 where I can't configure the system to allow
> RT tasks for a non-root user.
> 
> In 2.6.26.5, I was able to do the following to set things up nicely:
> echo 450000 >/sys/kernel/uids/0/cpu_rt_runtime
> echo 450000 >/sys/kernel/uids/1000/cpu_rt_runtime
> 
> I've searched lkml archives and am unable to figure out what changed.
> As far as I can tell, the documentation (sched-rt-group.txt) says this
> should work, and indeed, it did work with 2.6.26.
> 
> Seems like every value I try to echo into the /sys files returns EINVAL.
>  Even when I'm just writing the same value it already had:
> 
> chirp uids # pwd
> /sys/kernel/uids
> chirp uids # cat 0/cpu_rt_period
> 1000000
> chirp uids # cat 0/cpu_rt_runtime
> 950000
> chirp uids # cat 1000/cpu_rt_period
> 1000000
> chirp uids # cat 1000/cpu_rt_runtime
> 0
> chirp uids # echo 450000 >0/cpu_rt_runtime
> echo: write error: invalid argument
> chirp uids # echo 450000 >1000/cpu_rt_runtime
> echo: write error: invalid argument
> chirp uids # echo 950000 >0/cpu_rt_runtime
> echo: write error: invalid argument
> chirp uids # echo 0 >0/cpu_rt_runtime
> echo: write error: invalid argument
> 
> So it seems rt_schedulable() is never succeeding.  Any ideas?

Yeah, I should test this user grouping stuff more often :/

The below fixes it for me.
---
Subject: sched: fix bandwidth validation for UID grouping 

For UID grouping we initialize the root group with infinite bandwidth
which by default is actually more than the global limit, therefore the
bandwidth check always fails.

Because the root group is a phantom group (for UID grouping) we cannot
runtime adjust it, therefore we let it reflect the global bandwidth
settings.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
CC: stable@kernel.org
---
diff --git a/kernel/sched.c b/kernel/sched.c
index 02f35a1..a61fb0e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -9195,6 +9195,13 @@ static int tg_schedulable(struct task_group *tg, void *data)
 		runtime = d->rt_runtime;
 	}
 
+#ifdef CONFIG_USER_SCHED
+	if (tg == &root_task_group) {
+		period = global_rt_period();
+		runtime = global_rt_runtime();
+	}
+#endif
+
 	/*
 	 * Cannot have more runtime than the period.
 	 */


  reply	other threads:[~2009-01-14  9:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-13 18:31 2.6.28 has unconfigurable group sched? Mark Glines
2009-01-14  9:56 ` Peter Zijlstra [this message]
2009-01-14 14:46   ` Mark Glines
2009-01-15  7:29     ` Peter Zijlstra
2009-01-15 16:00       ` Mark Glines

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=1231926992.7141.23.camel@twins \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@glines.org \
    --cc=mingo@elte.hu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox