public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "'joe.korty@ccur.com'" <joe.korty@ccur.com>
To: george anzinger <george@mvista.com>
Cc: "Perez-Gonzalez, Inaky" <inaky.perez-gonzalez@intel.com>,
	"'Andrew Morton'" <akpm@digeo.com>,
	"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>,
	"'mingo@elte.hu'" <mingo@elte.hu>, "Li, Adam" <adam.li@intel.com>,
	Robert Love <rml@mvista.com>
Subject: Re: O(1) scheduler seems to lock up on sched_FIFO and sched_RR ta sks
Date: Thu, 19 Jun 2003 13:19:51 -0400	[thread overview]
Message-ID: <20030619171950.GA936@rudolph.ccur.com> (raw)
In-Reply-To: <3EF1DE35.20402@mvista.com>

> Hm!  I wonder.  Robert is working on a fix for schedsetschedule() 
> where it fails to actually tell the scheduler to switch to a process 
> that it just made higher priority or away from one it just lowered.
> 
> The net result is that the caller keeps running (FIFO for all in this 
> case) when, in fact it should have been switched out.  Next time 
> schedule() actually switches, it is all sorted out again.  Could the 
> elavation of the events/0 thread cause this needed switch?


I posted a fix for this a month ago that was ignored.  Which is a
good thing, since now that I look at it again, I don't care for the
approach I took nor does it appear to be complete.

Joe

----------- original posting

> Date: Wed, 21 May 2003 16:40:26 -0400
> From: Joe Korty <joe.korty@ccur.com>
> To: Ingo Molnar <mingo@elte.hu>
> Cc: linux-kernel@vger.kernel.org
> Subject: [PATCH] setscheduler resched bug

setscheduler is not forcing a reschedule when needed like set_user_nice
does.  It should.

Joe


--- 2.5.69/kernel/sched.c.orig	2003-05-21 14:50:53.000000000 -0400
+++ 2.5.69/kernel/sched.c	2003-05-21 15:01:13.000000000 -0400
@@ -1716,6 +1716,7 @@
 	unsigned long flags;
 	runqueue_t *rq;
 	task_t *p;
+	int oldprio;
 
 	if (!param || pid < 0)
 		goto out_nounlock;
@@ -1778,12 +1779,20 @@
 	retval = 0;
 	p->policy = policy;
 	p->rt_priority = lp.sched_priority;
+	oldprio = p->prio;
 	if (policy != SCHED_NORMAL)
 		p->prio = MAX_USER_RT_PRIO-1 - p->rt_priority;
 	else
 		p->prio = p->static_prio;
-	if (array)
+	if (array) {
 		__activate_task(p, task_rq(p));
+		/*
+		 * Reschedule if on a CPU and the priority dropped, or not on
+		 * a CPU and the priority rose above the currently running task.
+		 */
+		if ((rq->curr == p) ? (p->prio > oldprio) : (p->prio < rq->curr->prio))
+			resched_task(rq->curr);
+	}
 
 out_unlock:
 	task_rq_unlock(rq, &flags);


  reply	other threads:[~2003-06-19 17:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-19  6:06 O(1) scheduler seems to lock up on sched_FIFO and sched_RR ta sks Perez-Gonzalez, Inaky
2003-06-19  6:07 ` Ingo Molnar
2003-06-19 16:00 ` george anzinger
2003-06-19 17:19   ` 'joe.korty@ccur.com' [this message]
2003-06-19 17:23     ` Robert Love
2003-06-19 17:28       ` Joe Korty
2003-06-19 17:45     ` [patch] setscheduler fix Robert Love
2003-06-19 18:20       ` Joe Korty
2003-06-19 18:38         ` Robert Love
2003-06-19 19:09       ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2003-06-20  2:53 O(1) scheduler seems to lock up on sched_FIFO and sched_RR ta sks Perez-Gonzalez, Inaky
2003-06-19 19:22 Perez-Gonzalez, Inaky
2003-06-19 18:31 Perez-Gonzalez, Inaky
2003-06-19 18:36 ` Robert Love
2003-06-19  6:52 Perez-Gonzalez, Inaky
2003-06-19 17:43 ` Robert Love
2003-06-19  4:38 Perez-Gonzalez, Inaky
2003-06-19  2:55 Perez-Gonzalez, Inaky
2003-06-19  1:44 Perez-Gonzalez, Inaky
2003-06-19  1:58 ` Robert Love
2003-06-19  2:02 ` george anzinger
2003-06-19  4:34 ` 'joe.korty@ccur.com'

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=20030619171950.GA936@rudolph.ccur.com \
    --to=joe.korty@ccur.com \
    --cc=adam.li@intel.com \
    --cc=akpm@digeo.com \
    --cc=george@mvista.com \
    --cc=inaky.perez-gonzalez@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rml@mvista.com \
    /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