From: Antonio Vargas <wind@cocodriloo.com>
To: William Lee Irwin III <wli@holomorphy.com>,
Antonio Vargas <wind@cocodriloo.com>,
Hubertus Franke <frankeh@watson.ibm.com>,
linux-kernel@vger.kernel.org, Robert Love <rml@tech9.net>
Subject: Re: fairsched + O(1) process scheduler
Date: Fri, 4 Apr 2003 22:12:41 +0200 [thread overview]
Message-ID: <20030404201241.GB15864@wind.cocodriloo.com> (raw)
In-Reply-To: <20030404140447.GC1828@holomorphy.com>
On Fri, Apr 04, 2003 at 06:04:47AM -0800, William Lee Irwin III wrote:
> On Thu, Apr 03, 2003 at 11:22:41AM -0800, William Lee Irwin III wrote:
> >> Use spin_lock_irq(&uidhash_lock) or you will deadlock if you hold it
> >> while you take a timer tick, but it's wrong anyway. it's O(N) with
> >> respect to number of users present. An O(1) algorithm could easily
> >> make use of reference counts held by tasks.
> [...]
> >> This isn't right, when expiration happens needs to be tracked by both
> >> user and task. Basically which tasks are penalized when the user
> >> expiration happens? The prediction is the same set of tasks will always
> >> be the target of the penalty.
>
> On Fri, Apr 04, 2003 at 01:27:04PM +0200, Antonio Vargas wrote:
> > Just out of experimenting, I've coded something that looks reasonable
> > and would not experience starvation.
> > In the normal scheduler, a non-interactive task will, when used all
> > his timeslice, reset p->time_slice and queue onto the expired array.
> > I'm now reseting p->reserved_time_slice instead and queuing the task
> > onto a per-user pending task queue.
> > A separate kernel thread walks the user list, calculates the user
> > timeslice and distributes it to it's pending tasks. When a task
> > receives timeslices, it's moved from the per-user pending queue to
> > the expired array of the runqueue, thus preparing it to run on the
> > next array-switch.
>
> Hmm, priorities getting recalculated by a kernel thread sounds kind of
> scary, but who am I to judge?
First and foremost, root user is handled as usual, so kernel tasks should
also be handled as usual if they always run as root...
but I've yet to find out how to check if a task is a kernel thread or not,
and skip these explicitely just to be safe.
Also, while I've coded it on a kernel thread, I'd settle perfectly to a
periodic timer, but I don't know yet ask for one... perhaps a
self-propagating workqueue entry with a delay?
> On Fri, Apr 04, 2003 at 01:27:04PM +0200, Antonio Vargas wrote:
> > If the user has many timeslices, he can give timeslices to many tasks, thus
> > getting more work done.
> > While the implementation may not be good enough, due to locking problems and
> > the use of a kernel-thread, I think the fundamental algorithm feels right.
> > William, should I take the lock on the uidhash_list when adding a task
> > to a per-user task list?
>
> Possible, though I'd favor a per-user spinlock.
So, when trying to add a task to the per-user pending tasks, I'd have
to do this:
1. spin_lock_irqsave(uidhash_lock, flags)
2. spin_lock(my_user->user_lock)
3. spin_unlock_restore(uidhash_lock, flags);
Is this any good?
Could I simply do "spin_unlock(my_user->user_lock)" at end without
taking the uidhash_lock again?
> The code looks reasonable now, modulo that race you asked about.
What do I need to lock when I want to add a task to a runqueue?
I'm doing a "spin_lock_irq(this_rq()->lock);"
As you can see, I'm not yet at speed with the locking rules... any
online references to the latest locking rules? The BKL was really
easy to understand in comparison! *grin*
Greets, Antonio.
next prev parent reply other threads:[~2003-04-04 19:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-01 12:51 Antonio Vargas
2003-04-01 16:41 ` William Lee Irwin III
2003-04-01 22:19 ` Antonio Vargas
2003-04-02 12:46 ` Antonio Vargas
2003-04-02 16:35 ` William Lee Irwin III
2003-04-02 21:36 ` Antonio Vargas
2003-04-02 21:35 ` Robert Love
2003-04-02 22:07 ` Antonio Vargas
2003-04-02 22:10 ` Robert Love
2003-04-02 22:35 ` Antonio Vargas
2003-04-03 17:15 ` Corey Minyard
2003-04-03 18:17 ` Robert Love
[not found] ` <200304021144.21924.frankeh@watson.ibm.com>
2003-04-03 12:53 ` Antonio Vargas
2003-04-03 19:22 ` William Lee Irwin III
2003-04-04 11:27 ` Antonio Vargas
2003-04-04 14:04 ` William Lee Irwin III
2003-04-04 20:12 ` Antonio Vargas [this message]
2003-04-04 20:40 ` William Lee Irwin III
[not found] ` <200304041453.16630.frankeh@watson.ibm.com>
2003-04-04 21:36 ` Antonio Vargas
[not found] ` <200304081456.34367.frankeh@watson.ibm.com>
2003-04-08 20:19 ` Antonio Vargas
2003-04-01 18:33 ` Robert Love
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=20030404201241.GB15864@wind.cocodriloo.com \
--to=wind@cocodriloo.com \
--cc=frankeh@watson.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rml@tech9.net \
--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
all inboxes | Powered by JetHome®