linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: Con Kolivas <kernel@kolivas.org>
Cc: gaxt <gaxt@rogers.com>, linux-kernel@vger.kernel.org
Subject: Re: WINE + Galciv + 2.6.0-test3-mm1-O15
Date: Wed, 13 Aug 2003 14:47:42 +0200	[thread overview]
Message-ID: <5.2.1.1.2.20030813144306.0198a058@pop.gmx.net> (raw)
In-Reply-To: <200308131334.54598.kernel@kolivas.org>

[-- Attachment #1: Type: text/plain, Size: 2726 bytes --]

At 01:34 PM 8/13/2003 +1000, Con Kolivas wrote:
>On Wed, 13 Aug 2003 04:24, Mike Galbraith wrote:
> > At 12:40 AM 8/13/2003 +1000, Con Kolivas wrote:
> > >On Wed, 13 Aug 2003 00:42, gaxt wrote:
> > > > Photoshop 6 (yes, legal owned version) in wine is flawless (as it was
> > > > with 2.6.0-test3)
> > > >
> > > > Galciv plays videos quite smoothly but as soon as I run it it will
> > > > freeze the cursor for 12-15 seconds every half-minute or so even within
> > > > the game itself which is turn-based strategy without a lot of whizbang
> > > > stuff. In the past, the videos would stutter but the game would not
> > > > suffer from more than short pauses now and then.
> > >
> > >Yes, herein lies one of those mysteries that still eludes me but I have
> > > been investigating it. I can now reproduce in other applications what
> > > appears to be the problem - Two cpu hogs, X and evolution for example are
> > > running and evolution is making X the cpu hog. The problem is that X gets
> > > demoted whereas evolution doesn't. Strangely, dropping evolution to nice
> > > +1 or making X -1 seems to change which one gets demoted, and X is now
> > > much smoother. I assume the same thing is happening here between wine and
> > > wineserver, which is why you've seen reversal of priorities in your
> > > previous posts. See if renicing one of them +1 helps for the time being.
> > > I will continue investigating to find out why the heck this happens and
> > > try and fix it.
> > >
> > >Con
> > >
> > >P.S. I've cc'ed MG because he has seen the scheduler do other forms of
> > >trickery and may have thoughts on why this happens.
> >
> > That sounds suspiciously similar to my scenario, but mine requires a third
> > element to trigger.
> >
> > <scritch scritch scritch>
> >
> > What about this?  In both your senario and mine, X is running low on cash
> > while doing work at the request of a client right?  Charge for it.  If X is
> > lower on cash than the guy he's working for, pick the client's pocket...
> > take the remainder of your slice from his sleep_avg for your trouble.  If
> > you're not in_interrupt(), nothing's free.  Similar to Robinhood, but you
> > take from the rich, and keep it :)  He's probably going straight to the
> > bank after he wakes you anyway, so he likely won't even miss it.  Instead
> > of backboost of overflow, which can cause nasty problems, you could try
> > backtheft.
>
>Not a bad idea at all. The working for someone else thing is killing me. Now,
>how to implement...

I had to back up and regroup a bit because of backboost sanity problems 
(wish I could pull those dang fangs, backboost is wonderful otherwise), but 
the attached cured my inversion problem.

         -Mike 

[-- Attachment #2: xx.diff --]
[-- Type: application/octet-stream, Size: 1400 bytes --]

--- linux-2.6.0-test1.G8/kernel/sched.c.org	Wed Aug 13 09:19:13 2003
+++ linux-2.6.0-test1.G8/kernel/sched.c	Wed Aug 13 14:41:42 2003
@@ -358,6 +358,8 @@
 
 	if (sleep_time > 0) {
 		unsigned long long sleep_avg;
+		unsigned long run_time = now - current->timestamp;
+		unsigned int slice = 1000000 * current->time_slice;
 
 		/*
 		 * This code gives a bonus to interactive tasks.
@@ -381,6 +383,22 @@
 			p->sleep_avg = sleep_avg;
 			p->prio = effective_prio(p);
 		}
+		/*
+		 * If the awakened task has been asleep for longer than the
+		 * waker has had the CPU plus round-robin time, and it is
+		 * going to preempt, there is a good chance that the waker
+		 * is not getting enough CPU to service the awakened task in
+		 * a timely manner, and that this is the cause of the preempt.
+		 * Take some of the resulting sleep_time from the awakened
+		 * task, and give it to the waker.
+		 */
+		if (!in_interrupt() && p->mm && current->mm && sleep_avg >
+				current->sleep_avg + slice && sleep_time > run_time +
+				(1000000 * this_rq()->nr_running * TIMESLICE_GRANULARITY) &&
+				TASK_PREEMPTS_CURR(p, task_rq(current))) {
+			current->sleep_avg += slice;
+			sleep_avg -= slice;
+		}
 	}
 }
 
@@ -1414,6 +1432,7 @@
 		next->timestamp = now;
 		rq->nr_switches++;
 		rq->curr = next;
+		next->timestamp = now;
 
 		prepare_arch_switch(rq, next);
 		prev = context_switch(rq, prev, next);

  reply	other threads:[~2003-08-13 12:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-26 21:49 WINE + Galciv + Con Kolivar's 09 patch to 2.6.0-test1-mm2 gaxt
2003-07-27  2:05 ` Con Kolivas
2003-07-28  5:17   ` 260test2+O10int breaks : " gaxt
2003-07-28 21:40   ` gaxt
2003-07-28 21:39     ` Con Kolivas
2003-07-29  2:30       ` gaxt
2003-07-29  3:25         ` Con Kolivas
2003-07-29 12:48           ` WINE + Galciv + Con Kolivas's 011 patch to 2.6.0-test2 gaxt
2003-07-29 12:46             ` Con Kolivas
2003-07-29 20:59               ` gaxt
2003-07-29 21:09                 ` gaxt
2003-07-29 21:13                   ` gaxt
2003-08-08 20:04               ` 2.6.0-test2-mm5 + July Wine + Galciv gaxt
2003-08-12 14:42               ` WINE + Galciv + 2.6.0-test3-mm1-O15 gaxt
2003-08-12 14:40                 ` Con Kolivas
2003-08-12 18:24                   ` Mike Galbraith
2003-08-12 18:44                     ` Timothy Miller
2003-08-12 18:48                       ` Mike Galbraith
2003-08-13  3:34                     ` Con Kolivas
2003-08-13 12:47                       ` Mike Galbraith [this message]
2003-08-12 15:23 Voluspa
2003-08-12 21:15 ` Con Kolivas
2003-08-13  0:54   ` Voluspa
2003-08-13 18:45     ` Timothy Miller
2003-08-13 21:21       ` Con Kolivas

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=5.2.1.1.2.20030813144306.0198a058@pop.gmx.net \
    --to=efault@gmx.de \
    --cc=gaxt@rogers.com \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).