From: Con Kolivas <kernel@kolivas.org>
To: Mike Galbraith <efault@gmx.de>
Cc: linux list <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@elte.hu>, ck list <ck@vds.kolivas.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: rSDl cpu scheduler version 0.34-test patch
Date: Mon, 26 Mar 2007 17:19:00 +1000 [thread overview]
Message-ID: <200703261719.01444.kernel@kolivas.org> (raw)
In-Reply-To: <1174885253.7040.57.camel@Homer.simpson.net>
On Monday 26 March 2007 15:00, Mike Galbraith wrote:
> On Mon, 2007-03-26 at 11:00 +1000, Con Kolivas wrote:
> > This is just for testing at the moment! The reason is the size of this
> > patch.
>
> (no testing done yet, but I have a couple comments)
>
> > In the interest of evolution, I've taken the RSDL cpu scheduler and
> > increased the resolution of the task timekeeping to nanosecond
> > resolution.
>
> + /* All the userspace visible cpu accounting is done here */
> + time_diff = now - p->last_ran;
> ...
> + /* cpu scheduler quota accounting is performed here */
> + if (p->policy != SCHED_FIFO)
> + p->time_slice -= time_diff;
>
> If we still have any jiffies resolution clocks out there, this could be
> a bit problematic.
Works fine with jiffy only resolution. sched_clock just returns the change
when it happens. This leaves us with the accuracy of the previous code on
hardware that doesn't give higher resolution time from sched_clock.
> +static inline void enqueue_pulled_task(struct rq *src_rq, struct rq *rq,
> + struct task_struct *p)
> +{
> + int queue_prio;
> +
> + p->array = rq->active; <== set
> + if (!rt_task(p)) {
> + if (p->rotation == src_rq->prio_rotation) {
> + if (p->array == src_rq->expired) { <== evaluate
I don't see a problem.
> + queue_expired(p, rq);
> + goto out_queue;
> + }
> + if (p->time_slice < 0)
> + task_new_array(p, rq);
> + } else
> + task_new_array(p, rq);
> + }
> + queue_prio = next_entitled_slot(p, rq);
>
> (bug aside, this special function really shouldn't exist imho, because
> there's nothing special going on. we didn't need it before to do the
> same thing, so we shouldn't need it now.)
As the comment says, the likelihood that both runqueues happen to be at the
same priority_level is very low so the exact position cannot be transposed in
my opinion. I'll see if I can simplify it though.
> +static void recalc_task_prio(struct task_struct *p, struct rq *rq)
> +{
> + struct prio_array *array = rq->active;
> + int queue_prio;
> +
> + if (p->rotation == rq->prio_rotation) {
> + if (p->array == array) {
> + if (p->time_slice > 0)
> + return;
> + p->time_slice = p->quota;
> + } else if (p->array == rq->expired) {
> + queue_expired(p, rq);
> + return;
> + } else
> + task_new_array(p, rq);
> + } else
>
> Dequeueing a task still leaves a stale p->array laying around to be
> possibly evaluated later.
I don't see quite why that's a problem. If there's memory of the last dequeue
and it enqueues at a different rotation it gets ignored. If it enqueues
during the same rotation then that memory proves useful for ensuring it
doesn't get a new full quota. Either way the array is always updated on
enqueue so it wont be trying to add it to the wrong runlist.
> try_to_wake_up() doesn't currently evaluate
> and set p->rotation (but should per design doc),
try_to_wake_up->activate_task->enqueue_task->recalc_task_prio which updates
p->rotation
> so when you get here, a
> cross-cpu waking task won't continue it's rotation. If it did evaluate
> and set, recalc_task_prio() would evaluate the guaranteed to fail these
> tests array pointer, so the task will still not continue it's rotation.
> Stale pointers are evil.
I prefer to use the array value as a memory in case it wakes up on the same
rotation and runqueue.
>
> -Mike
Thanks.
--
-ck
next prev parent reply other threads:[~2007-03-26 7:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-26 1:00 rSDl cpu scheduler version 0.34-test patch Con Kolivas
2007-03-26 5:00 ` Mike Galbraith
2007-03-26 7:19 ` Con Kolivas [this message]
2007-03-26 8:10 ` Mike Galbraith
2007-03-26 8:39 ` Mike Galbraith
2007-03-26 5:46 ` Ingo Molnar
2007-03-26 5:53 ` Ingo Molnar
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=200703261719.01444.kernel@kolivas.org \
--to=kernel@kolivas.org \
--cc=akpm@linux-foundation.org \
--cc=ck@vds.kolivas.org \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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.