From: Peter Williams <pwil3058@bigpond.net.au>
To: Mike Galbraith <efault@gmx.de>
Cc: Andrew Morton <akpm@osdl.org>,
Nick Piggin <nickpiggin@yahoo.com.au>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Con Kolivas <kernel@kolivas.org>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] sched: Add SCHED_BGND (background) scheduling policy
Date: Wed, 05 Jul 2006 23:59:19 +1000 [thread overview]
Message-ID: <44ABC5B7.2090707@bigpond.net.au> (raw)
In-Reply-To: <1152099752.8684.198.camel@Homer.TheSimpsons.net>
Mike Galbraith wrote:
> On Wed, 2006-07-05 at 09:35 +1000, Peter Williams wrote:
>
>> @@ -3332,23 +3447,25 @@ need_resched_nonpreemptible:
>> }
>>
>> array = rq->active;
>> - if (unlikely(!array->nr_active)) {
>> - /*
>> - * Switch the active and expired arrays.
>> - */
>> - schedstat_inc(rq, sched_switch);
>> - rq->active = rq->expired;
>> - rq->expired = array;
>> - array = rq->active;
>> - rq->expired_timestamp = 0;
>> - rq->best_expired_prio = MAX_PRIO;
>> - }
>> + if (unlikely(!array->nr_active))
>> + array = switch_arrays(rq, MAX_PRIO);
>>
>> idx = sched_find_first_bit(array->bitmap);
>> +get_next:
>> queue = array->queue + idx;
>> next = list_entry(queue->next, struct task_struct, run_list);
>> + /* very strict backgrounding */
>> + if (unlikely(task_in_background(next) && rq->expired->nr_active)) {
>> + int tmp = sched_find_first_bit(rq->expired->bitmap);
>> +
>> + if (likely(tmp < idx)) {
>> + array = switch_arrays(rq, idx);
>> + idx = tmp;
>> + goto get_next;
>
> Won't this potentially expire the mutex holder which you specifically
> protect in scheduler_tick() if it was preempted before being ticked?
I don't think so as its prio value should cause task_in_background() to
fail.
> The task in the expired array could also be a !safe_to_background() task
> who already had a chance to run, and who's slice expired.
If it's !safe_to_background() it's in our interest to let it run in
order to free up the resource that it's holding.
>
> If it's worth protecting higher priority tasks from mutex holders ending
> up in the expired array, then there's a case that should be examined.
It's more than just stopping them end up in the expired array. It's
stopping them being permanently in the expired array.
> There's little difference between a background task acquiring a mutex,
> and a normal task with one tick left on it's slice.
The difference is that the background task could stay there forever.
> Best for sleepers
> is of course to just say no to expiring mutex holders period.
In spite of my comments above, I agree that not expiring mutex holders
might (emphasis on the "might") be good for overall system performance
by reducing the time for which locks are held. Giving them a whole new
time slice on the active array might be too generous though. It could
become quite complex.
Peter
--
Peter Williams pwil3058@bigpond.net.au
"Learning, n. The kind of ignorance distinguishing the studious."
-- Ambrose Bierce
next prev parent reply other threads:[~2006-07-05 13:59 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-04 23:35 [PATCH] sched: Add SCHED_BGND (background) scheduling policy Peter Williams
2006-07-05 0:14 ` Con Kolivas
2006-07-05 0:49 ` Peter Williams
2006-07-05 0:52 ` Con Kolivas
2006-07-05 8:05 ` Andreas Mohr
2006-07-05 14:04 ` Jan Engelhardt
2006-07-05 0:44 ` Con Kolivas
2006-07-05 1:15 ` Peter Williams
2006-07-05 1:33 ` Con Kolivas
2006-07-05 4:20 ` Valdis.Kletnieks
2006-07-05 3:06 ` Peter Williams
2006-07-05 6:35 ` Ingo Molnar
2006-07-05 8:03 ` Peter Williams
2006-07-05 8:15 ` Arjan van de Ven
2006-07-05 8:19 ` Ingo Molnar
2006-07-05 17:40 ` Nick Piggin
2006-07-05 11:42 ` Mike Galbraith
2006-07-05 13:59 ` Peter Williams [this message]
2006-07-05 14:18 ` Peter Williams
2006-07-05 14:48 ` Mike Galbraith
2006-07-06 23:50 ` Peter Williams
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=44ABC5B7.2090707@bigpond.net.au \
--to=pwil3058@bigpond.net.au \
--cc=akpm@osdl.org \
--cc=efault@gmx.de \
--cc=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nickpiggin@yahoo.com.au \
/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.