Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c61935fd0e7f087a643827b4bf5ef646963c10fa
Commit:     c61935fd0e7f087a643827b4bf5ef646963c10fa
Parent:     d384e35a25445bb60457b7dab8cffe178c6b7ecb
Author:     Ingo Molnar <[EMAIL PROTECTED]>
AuthorDate: Tue Jan 22 11:24:58 2008 +0100
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Tue Jan 22 11:24:58 2008 +0100

    sched: group scheduler, set uid share fix
    
    setting cpu share to 1 causes hangs, as reported in:
    
        http://bugzilla.kernel.org/show_bug.cgi?id=9779
    
    as the default share is 1024, the values of 0 and 1 can indeed
    cause problems. Limit it to 2 or higher values.
    
    These values can only be set by the root user - but still it
    makes sense to protect against nonsensical values.
    
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 kernel/sched.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 37cf07a..e76b11c 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7153,6 +7153,14 @@ int sched_group_set_shares(struct task_group *tg, 
unsigned long shares)
 {
        int i;
 
+       /*
+        * A weight of 0 or 1 can cause arithmetics problems.
+        * (The default weight is 1024 - so there's no practical
+        *  limitation from this.)
+        */
+       if (shares < 2)
+               shares = 2;
+
        spin_lock(&tg->lock);
        if (tg->shares == shares)
                goto done;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to