From: Con Kolivas <kernel@kolivas.org>
To: Voluspa <voluspa@comhem.se>
Cc: linux kernel mailing list <linux-kernel@vger.kernel.org>,
Mike Galbraith <efault@gmx.de>, Andrew Morton <akpm@osdl.org>,
William Lee Irwin III <wli@holomorphy.com>
Subject: [RFC] Re: Blender profiling-1 O16.2int
Date: Sun, 17 Aug 2003 23:36:42 +1000 [thread overview]
Message-ID: <200308172336.42593.kernel@kolivas.org> (raw)
In-Reply-To: <20030817073859.51021571.voluspa@comhem.se>
I've investigated this starvation issue now that I've been given a testcase.
First some background. Mats reported that he could elicit starvation in
blender so I downloaded that and have been thrashing it out trying to find
out what happens. Here are relevant excerpts from the discussion.
On Sun, 17 Aug 2003 15:38, Voluspa wrote:
> Ah, the freezes has been there with all 2.6s, just shorter (1/2 - 2
> seconds). Where I didn't see them was in the older blender version of
> 2.23. I'll investigate it more thorough.
This struck me as interesting because the starvation was there in the vanilla
scheduler anyway, but for a shorter period. Even more interesting was the
suggestion that it didn't happen with previous versions of blender.
Reproducing it was:
> Voluspa <voluspa@comhem.se> wrote:
>Thusly: Start program, move mouse to get rid of splash screen. Click and
>hold down 3rd mouse button (unless you use simulate 3 buttons in X, then
>it's left-right-mousebutton simultaniously) anywhere on the white grid
>(first view is top-down) and move mouse around... That is how you rotate
>the world plane around an axes. Doing this quickly, or slowly for a
>longer period, I freeze.
Which I tried for some time and eventually managed to get locally. In the
meantime,
> Voluspa <voluspa@comhem.se> wrote:
> But not in 2.23, not even with this O16.2! Don't see any freezes with
> that older Blender version.
So I had my suspicions about what was happening already based on that
information. Anyway I ran top in batch mode, reproduced the starvation and
got this (just X and 3[blender] at one second intervals):
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ Command
782 root 16 0 109m 39m 77m R 80.5 7.9 2:37.17 X
12553 con 15 0 12648 6252 9072 S 19.9 1.2 0:07.98 3
782 root 16 0 109m 39m 77m R 73.6 7.9 2:37.91 X
12553 con 15 0 12648 6252 9072 R 23.9 1.2 0:08.22 3
782 root 16 0 109m 39m 77m R 79.5 7.9 2:38.71 X
12553 con 15 0 12648 6252 9072 S 20.9 1.2 0:08.43 3
Starvation starts here:
782 root 16 0 109m 39m 77m R 95.4 7.9 2:39.67 X
12553 con 15 0 12648 6252 9072 S 3.0 1.2 0:08.46 3
12553 con 16 0 12648 6252 9072 R 73.6 1.2 0:09.20 3
782 root 17 0 109m 39m 77m R 25.8 7.9 2:39.93 X
12553 con 16 0 12648 6252 9072 R 98.4 1.2 0:10.19 3
782 root 17 0 109m 39m 77m R 0.0 7.9 2:39.93 X
12553 con 16 0 12648 6252 9072 R 99.4 1.2 0:11.19 3
782 root 17 0 109m 39m 77m R 0.0 7.9 2:39.93 X
12553 con 16 0 12648 6252 9072 R 99.4 1.2 0:12.19 3
782 root 17 0 109m 39m 77m R 0.0 7.9 2:39.93 X
12553 con 16 0 12648 6252 9072 R 99.9 1.2 0:13.20 3
782 root 17 0 109m 39m 77m R 0.0 7.9 2:39.93 X
[snip some more seconds]
and ends here:
12553 con 15 0 12648 6252 9072 S 39.8 1.2 0:23.59 3
782 root 16 0 109m 39m 77m S 16.9 7.9 2:40.10 X
782 root 15 0 109m 39m 77m S 8.9 7.9 2:40.19 X
12553 con 15 0 12964 6576 9072 S 2.0 1.3 0:23.61 3
Now for those that can't see what this is, blender and X are interactive tasks
and getting high priority (PRI < 18) which makes sense. During heavy usage of
blender, it is X that gets pegged for cpu usage (ie it is doing the work for
blender), and eventually it gets expired onto the expired array for being
naughty and stops doing anything till all other tasks have finished working
on the active array. Now normally, blender should just sleep and wait till X
comes alive again before it does anything. However here it shows clearly that
it is spinning madly looking for something from X, and poor X can't do
anything. This is the busy on wait I've described. Meanwhile, since blender
was seen as an interactive task (which it is), it preempts everything lower
priority than it till it also gets booted.
Now in O16.2 I managed to minimise this happening by not allowing tasks to
preempt their waker, but this has no effect if X gets expired. The evidence I
really needed was that this also happened to the vanilla scheduler to a
lesser degree and that it is a software flaw. This same thing happens to
2.6.0-test3 for 1-2 seconds, and doesn't happen at all with a previous
version of blender.
So where does this leave us?
Well first I can remove entirely the not preempting the waker in O16s since
that is faulty for smp, and doesn't really fix the problem.
Second, any applications that exhibit this should be fixed since it is a bug.
Finally I still need to find a way to prevent this from transiently starving
the system without undoing the interactive improvements to normal
applications; I certainly don't intend to make them "work nicely" just for
the sake of it.
I do have some ideas about how to progress with this (some Mike has suggested
to me previously), but so far most of them involve some detriment to the
interactive performance on other apps. So I'm appealing to others for ideas.
Comments?
Con
next parent reply other threads:[~2003-08-17 13:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20030817003128.04855aed.voluspa@comhem.se>
[not found] ` <200308171142.33131.kernel@kolivas.org>
[not found] ` <20030817073859.51021571.voluspa@comhem.se>
2003-08-17 13:36 ` Con Kolivas [this message]
2003-08-17 16:34 ` [RFC] Re: Blender profiling-1 O16.2int Con Kolivas
2003-08-18 0:30 ` William Lee Irwin III
2003-08-19 0:14 ` Wes Janzen
2003-08-19 0:28 ` Con Kolivas
2003-08-19 0:37 ` Richard A Nelson
2003-08-19 8:39 ` Rob Landley
2003-08-19 0:31 ` William Lee Irwin III
2003-08-19 0:58 ` Wes Janzen
[not found] <20030818110001.6564.64238.Mailman@lists.us.dell.com>
2003-08-18 12:52 ` Max Hailperin
2003-08-18 13:05 ` Con Kolivas
2003-08-18 14:43 ` William Lee Irwin III
2003-08-26 2:54 Kester Maddock
2003-08-26 5:03 ` 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=200308172336.42593.kernel@kolivas.org \
--to=kernel@kolivas.org \
--cc=akpm@osdl.org \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=voluspa@comhem.se \
--cc=wli@holomorphy.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