mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-20 08:38:24 +08:00
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 <mingo@elte.hu>
This commit is contained in:
parent
d384e35a25
commit
c61935fd0e
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user