lkml.org 
[lkml]   [2014]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [BUG] [ tip/sched/core ] System unresponsive after booting
On Wed, Jan 15, 2014 at 05:25:55PM +0800, Michael wang wrote:
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 0326c06..bf4a6ed 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3464,6 +3464,10 @@ int sched_setscheduler(struct task_struct *p, int
> policy,
> .sched_policy = policy,
> .sched_priority = param->sched_priority
> };
> +
> + if (fair_policy(policy))
> + attr.sched_nice = PRIO_TO_NICE(attr.sched_priority);
> +
> return __sched_setscheduler(p, &attr, true);
> }
> EXPORT_SYMBOL_GPL(sched_setscheduler);
> @@ -3494,6 +3498,10 @@ int sched_setscheduler_nocheck(struct task_struct
> *p, int policy,
> .sched_policy = policy,
> .sched_priority = param->sched_priority
> };
> +
> + if (fair_policy(policy))
> + attr.sched_nice = PRIO_TO_NICE(attr.sched_priority);
> +
> return __sched_setscheduler(p, &attr, false);
> }

That seems wrong; the manpage confirms, from sched_setscheduler(2):

For processes scheduled under one of the normal scheduling
policies (SCHED_OTHER, SCHED_IDLE, SCHED_BATCH), sched_priority
is not used in scheduling decisions (it must be speci‐ fied as
0).

That said; we should probably preserve the nice value, which with the
current code we reset to 0.

---
kernel/sched/core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 0326c06953eb..f3abbb7dae62 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3462,7 +3462,8 @@ int sched_setscheduler(struct task_struct *p, int policy,
{
struct sched_attr attr = {
.sched_policy = policy,
- .sched_priority = param->sched_priority
+ .sched_priority = param->sched_priority,
+ .sched_nice = PRIO_TO_NICE(p->static_prio),
};
return __sched_setscheduler(p, &attr, true);
}
@@ -3492,7 +3493,8 @@ int sched_setscheduler_nocheck(struct task_struct *p, int policy,
{
struct sched_attr attr = {
.sched_policy = policy,
- .sched_priority = param->sched_priority
+ .sched_priority = param->sched_priority,
+ .sched_nice = PRIO_TO_NICE(p->static_prio),
};
return __sched_setscheduler(p, &attr, false);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2014-01-15 13:01    [W:0.174 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site