public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Williams <pwil3058@bigpond.net.au>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>, Mike Galbraith <efault@gmx.de>,
	Linux Kernel Mailing <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched: Make sure task has correct sched_class after policy change
Date: Mon, 12 Oct 2009 10:36:53 +1000	[thread overview]
Message-ID: <4AD27A25.8030802@bigpond.net.au> (raw)
In-Reply-To: <4ABA173B.4040106@bigpond.net.au>

On 23/09/09 22:40, Peter Williams wrote:
> On 23/09/09 16:32, Peter Zijlstra wrote:
>> On Wed, 2009-09-23 at 02:21 +0000, Peter Williams wrote:
>>> From the code in rt_mutex_setprio(), it is evident that the intention
>>> is that task's with a RT 'prio' value as a consequence of receiving a PI
>>> boost also have their 'sched_class' field set to '&rt_sched_class'.
>>> However, the code in __setscheduler() could result in this intention
>>> being frustrated.
>>>
>>> This patch fixes this problem.
>>>
>>> Signed-off-by: Peter Williams<pwil3058@bigpond.net.au>
>>
>> I think you're right, but the problem seems to be that it sets
>> sched_class based on policy, which seems fragile in the face of PI.
>>
>> How about the alternative below?
>
> Yes, that's what I meant to do i.e. use p->prio in the if condition. I
> sent a second patch with a fix but your solution is neater :-).
>
>>
>> ---
>> kernel/sched.c | 17 ++++-------------
>> 1 files changed, 4 insertions(+), 13 deletions(-)
>>
>> diff --git a/kernel/sched.c b/kernel/sched.c
>> index 91843ba..753a52c 100644
>> --- a/kernel/sched.c
>> +++ b/kernel/sched.c
>> @@ -6129,23 +6129,14 @@ __setscheduler(struct rq *rq, struct
>> task_struct *p, int policy, int prio)
>> {
>> BUG_ON(p->se.on_rq);
>>
>> - p->policy = policy;
>> - switch (p->policy) {
>> - case SCHED_NORMAL:
>> - case SCHED_BATCH:
>> - case SCHED_IDLE:
>> - p->sched_class =&fair_sched_class;
>> - break;
>> - case SCHED_FIFO:
>> - case SCHED_RR:
>> - p->sched_class =&rt_sched_class;
>> - break;
>> - }
>> -
>> p->rt_priority = prio;
>> p->normal_prio = normal_prio(p);
>> /* we are holding p->pi_lock already */
>> p->prio = rt_mutex_getprio(p);
>> + if (rt_prio(p->prio))
>> + p->sched_class =&rt_sched_class;
>> + else
>> + p->sched_class =&fair_sched_class;
>> set_load_weight(p);
>> }
>
> Peter

What ever happened to this patch?  It doesn't seem to have made it into 
the main line yet.

Cheers
Peter
-- 
Peter Williams                                   pwil3058@bigpond.net.au

"Learning, n. The kind of ignorance distinguishing the studious."
  -- Ambrose Bierce

  reply	other threads:[~2009-10-12  0:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-23  2:21 [PATCH] sched: Make sure task has correct sched_class after policy change Peter Williams
2009-09-23  6:32 ` Peter Zijlstra
2009-09-23 12:40   ` Peter Williams
2009-10-12  0:36     ` Peter Williams [this message]
2009-10-12 15:34       ` Peter Zijlstra
2009-10-14 13:13   ` [tip:sched/urgent] " tip-bot for Peter Zijlstra
  -- strict thread matches above, loose matches on Subject: below --
2009-09-23  2:03 [PATCH] " Peter Williams

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=4AD27A25.8030802@bigpond.net.au \
    --to=pwil3058@bigpond.net.au \
    --cc=a.p.zijlstra@chello.nl \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.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