From: Con Kolivas <kernel@kolivas.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, William Weston <weston@sysex.net>
Subject: Re: [patch] fix SMT scheduler latency bug
Date: Thu, 23 Jun 2005 00:40:55 +1000 [thread overview]
Message-ID: <200506230040.58846.kernel@kolivas.org> (raw)
In-Reply-To: <20050622102541.GA10043@elte.hu>
[-- Attachment #1: Type: text/plain, Size: 3398 bytes --]
Hi
On Wed, 22 Jun 2005 20:25, Ingo Molnar wrote:
> William Weston reported unusually high scheduling latencies on his x86
> HT box, on the -RT kernel. I managed to reproduce it on my HT box and
> the latency tracer shows the incident in action:
Thanks for picking this up. I've had a long hard look at the code and your
patch.
> the reason for this anomaly is the following code in dependent_sleeper():
>
> /*
> * If a user task with lower static priority than the
> * running task on the SMT sibling is trying to schedule,
> * delay it till there is proportionately less timeslice
> * left of the sibling task to prevent a lower priority
> * task from using an unfair proportion of the
> * physical cpu's resources. -ck
> */
> [...]
> if (((smt_curr->time_slice * (100 -
> sd->per_cpu_gain) / 100) > task_timeslice(p)))
> ret = 1;
>
> note that in contrast to the comment above, we dont actually do the
> check based on static priority, we do the check based on timeslices. But
> timeslices go up and down, and even highprio tasks can randomly have
> very low timeslices (just before their next refill) and can thus be
> judged as 'lowprio' by the above piece of code.
I don't see it like that. task_timeslice(p) will always return the same value
based purely on static priority and smt_curr->time_slice cannot ever be
larger than task_timeslice(p) unless there is a significant enough 'nice'
difference. It is not smt_curr that is rescheduled as a result of this test,
it is p that is not scheduled and we look at p's task_timeslice which does
not alter. The task that is delayed in either case is dependant on its static
priority which will determine its task_timeslice() vs the current value of
->time_slice on the sibling which is emptied as that task runs, and it is
expected to fluctuate.
> This condition is
> clearly buggy. The correct test is to check for static_prio _and_ to
> check for the preemption priority. Even on different static priority
> levels, a higher-prio interactive task should not be delayed due to a
> higher-static-prio CPU hog.
> - if (((smt_curr->time_slice * (100 - sd->per_cpu_gain) /
> - 100) > task_timeslice(p)))
> + if (smt_curr->static_prio < p->static_prio &&
> + !TASK_PREEMPTS_CURR(p, smt_rq) &&
> + smt_slice(smt_curr, sd) > task_timeslice(p))
Checking for smt_curr->static_prio < p->static_prio appears redundant to me
because the condition can only be met if there is a significant difference in
the different timeslice case as I mentioned above.
> + if (TASK_PREEMPTS_CURR(p, smt_rq) &&
Is this check necessary? The proportion is supposed to be distributed
according to static priority only.
If this code is causing large latencies then I believe it can only occur with
different nice levels running on siblings and high priority tasks starting
new timeslices repeatedly and never getting to the last per_cpu_gain% of
their timeslice. Ingo do you think this might be what is being seen? If this
truly can happen then this code will have to move to a jiffy based proportion
as the real time code is to prevent this problem.
Cheers,
Con
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2005-06-22 14:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-22 10:25 [patch] fix SMT scheduler latency bug Ingo Molnar
2005-06-22 14:40 ` Con Kolivas [this message]
2005-06-22 16:04 ` Ingo Molnar
2005-06-22 23:03 ` Con Kolivas
2005-06-22 23:32 ` Ingo Molnar
2005-06-23 0:03 ` Con Kolivas
2005-06-23 13:24 ` 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=200506230040.58846.kernel@kolivas.org \
--to=kernel@kolivas.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=weston@sysex.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.