mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: MIke Galbraith <efault@gmx.de>
To: Lee Revell <rlrevell@joe-job.com>
Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>,
	Con Kolivas <kernel@kolivas.org>,
	gcoady@gmail.com, linux-kernel@vger.kernel.org,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: 2.6 vs 2.4, ssh terminal slowdown
Date: Mon, 13 Feb 2006 05:59:21 +0100	[thread overview]
Message-ID: <1139806761.25253.33.camel@homer> (raw)
In-Reply-To: <1139801975.2739.72.camel@mindpipe>

On Sun, 2006-02-12 at 22:39 -0500, Lee Revell wrote:
> On Mon, 2006-02-13 at 04:09 +0100, MIke Galbraith wrote:
> > On Sun, 2006-02-12 at 18:39 -0500, Lee Revell wrote:

> > > Not only does this fix my "time ls" test case, it seems to drastically
> > > improve interactivity for my desktop apps.  I was really being plagued
> > > by weird stalls, it's much smoother now.
> > 
> > Yeah, but under load, that reluctance to release is fairly annoying...
> 
> This seems to manifest on my system as the mouse getting jerky under
> load.  Still, I don't mind - the overall feel is still smoother - as if
> the X server was getting too much CPU before.

Not only the X server, the interactivity boost in general is way too
severe.  It still needs work, but it's shaping up.  Who knows, it may
even get to the point of applying for inclusion.

Now, let's see if we can get your problem fixed with something that can
possibly go into 2.6.16 as a bugfix.  Can you please try the below?

This patch fixes two of what I would call thinkos in the interactivity
logic.  One, the requeuing of a freshly awakened task can lead to that
task losing it's slice of cpu upon preempt if it isn't alone in it's
queue.  Two, tasks which sleep for > INTERACTIVE_SLEEP(p), approximately
700ms, are treated as being idle, and prevented from slamming straight
to max dynamic priority for obvious reasons, yet a pure cpu hog that
sleeps for 100ms will fail the test, and subsequently have it's sleep
time multiplied by MAX_BONUS.

Just in case it does fix it for you, I'll even add a blame line.

Signed-off-by: Mike Galbraith <efault@gmx.de>

--- linux-2.6.16-rc3/kernel/sched.c.org	2006-02-13 04:44:57.000000000 +0100
+++ linux-2.6.16-rc3/kernel/sched.c	2006-02-13 05:11:18.000000000 +0100
@@ -150,8 +150,11 @@
 	((p)->prio <= (p)->static_prio - DELTA(p))
 
 #define INTERACTIVE_SLEEP(p) \
-	(JIFFIES_TO_NS(MAX_SLEEP_AVG * \
-		(MAX_BONUS / 2 + DELTA((p)) + 1) / MAX_BONUS - 1))
+	(min(JIFFIES_TO_NS(MAX_SLEEP_AVG * (MAX_BONUS / 2 + DELTA((p)) + 1) / \
+	MAX_BONUS - 1), NS_MAX_SLEEP_AVG))
+
+#define BONUS_MULTIPLIER(p) \
+	((MAX_BONUS - CURRENT_BONUS(p)) ? : 1)
 
 #define TASK_PREEMPTS_CURR(p, rq) \
 	((p)->prio < (rq)->curr->prio)
@@ -708,7 +711,7 @@
 		 * prevent them suddenly becoming cpu hogs and starving
 		 * other processes.
 		 */
-		if (p->mm && p->activated != -1 &&
+		if (p->mm && p->activated != -1 && BONUS_MULTIPLIER(p) *
 			sleep_time > INTERACTIVE_SLEEP(p)) {
 				p->sleep_avg = JIFFIES_TO_NS(MAX_SLEEP_AVG -
 						DEF_TIMESLICE);
@@ -717,7 +720,7 @@
 			 * The lower the sleep avg a task has the more
 			 * rapidly it will rise with sleep time.
 			 */
-			sleep_time *= (MAX_BONUS - CURRENT_BONUS(p)) ? : 1;
+			sleep_time *= BONUS_MULTIPLIER(p);
 
 			/*
 			 * Tasks waking from uninterruptible sleep are
@@ -3009,8 +3012,7 @@
 			dequeue_task(next, array);
 			next->prio = new_prio;
 			enqueue_task(next, array);
-		} else
-			requeue_task(next, array);
+		}
 	}
 	next->activated = 0;
 switch_tasks:



  reply	other threads:[~2006-02-13  4:53 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-08  2:11 Grant Coady
2006-02-08  2:24 ` Benjamin LaHaise
2006-02-08  2:50   ` Grant Coady
2006-02-08  3:02     ` Benjamin LaHaise
2006-02-08  2:35 ` Con Kolivas
2006-02-08  2:55   ` Grant Coady
2006-02-08  3:00     ` Con Kolivas
2006-02-08  4:12       ` Barry K. Nathan
2006-02-08  4:41         ` Grant Coady
2006-02-08  4:51       ` Grant Coady
2006-02-08  5:17         ` Willy Tarreau
2006-02-08  5:39           ` Grant Coady
2006-02-08  7:43       ` Lee Revell
2006-02-09 17:06   ` Jan Engelhardt
2006-02-09 20:06     ` Lee Revell
2006-02-10  6:35       ` MIke Galbraith
2006-02-12 13:47         ` MIke Galbraith
2006-02-12 19:03           ` Lee Revell
2006-02-12 21:36             ` MIke Galbraith
2006-02-12 23:23               ` Lee Revell
2006-02-12 23:39               ` Lee Revell
2006-02-13  3:09                 ` MIke Galbraith
2006-02-13  3:39                   ` Lee Revell
2006-02-13  4:59                     ` MIke Galbraith [this message]
2006-02-13  5:05                       ` Con Kolivas
2006-02-13  5:32                         ` MIke Galbraith
2006-02-13  5:37                           ` Con Kolivas
2006-02-13  5:57                             ` MIke Galbraith
2006-02-13  6:08                               ` Con Kolivas
2006-02-13  6:35                                 ` MIke Galbraith
2006-02-13  6:38                                   ` Lee Revell
2006-02-13  7:08                                     ` MIke Galbraith
2006-02-13  8:43                                       ` Lee Revell
2006-02-13 10:06                                         ` MIke Galbraith
2006-02-13 12:35                                         ` MIke Galbraith
2006-02-15  4:22                                           ` Lee Revell
2006-02-15  5:22                                             ` MIke Galbraith
2006-02-15  6:11                                               ` Lee Revell
2006-02-15  7:17                                                 ` MIke Galbraith
2006-02-13  7:15                                   ` Con Kolivas
2006-02-13  7:41                                     ` MIke Galbraith

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=1139806761.25253.33.camel@homer \
    --to=efault@gmx.de \
    --cc=gcoady@gmail.com \
    --cc=jengelh@linux01.gwdg.de \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rlrevell@joe-job.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

Powered by JetHome