From: Rusty Russell <rusty@rustcorp.com.au>
To: mingo@elte.hu
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] minor sched-E1 tweaks and questions
Date: Thu, 10 Jan 2002 14:48:42 +1100 [thread overview]
Message-ID: <E16OWCo-0000YO-00@wagner.rustcorp.com.au> (raw)
In-Reply-To: Your message of "Wed, 09 Jan 2002 11:41:19 BST." <Pine.LNX.4.33.0201091126520.2276-100000@localhost.localdomain>
In message <Pine.LNX.4.33.0201091126520.2276-100000@localhost.localdomain> you
write:
> > Q. How can this happen in expire_task():
> > if (p->array != rq->active) {
> > p->need_resched = 1;
> > return;
> > }
>
> if a task gets delayed by some really heavy IRQ load and the timer
> interrupt hits the task twice.
Hmm... still don't see it. update_process_times() surely doesn't
re-enter? And another CPU cannot load_balance() p (== current) away
from us.
Another question:
if (likely(prev != next)) {
rq->nr_switches++;
rq->curr = next;
next->cpu = prev->cpu;
context_switch(prev, next);
/*
* The runqueue pointer might be from another CPU
* if the new task was last running on a different
* CPU - thus re-load it.
*/
barrier();
rq = this_rq();
}
spin_unlock_irq(&rq->lock);
I do not understand this comment. How can rq (ie. smp_processor_id())
change? Nothing sleeps here, and if it DID change, the
spin_unlock_irq() would be wrong...
> i've taken your fixes, please double-check the next patch whether all of
> them are correctly applied.
Um, missed one:
static struct runqueue {
- int cpu;
spinlock_t lock;
- unsigned long nr_running, nr_switches, last_rt_event;
+ unsigned long nr_running, nr_switches;
task_t *curr, *idle;
prio_array_t *active, *expired, arrays[2];
- char __pad [SMP_CACHE_BYTES];
+ int prev_nr_running[NR_CPUS];
} runqueues [NR_CPUS] __cacheline_aligned;
You want each entry in the array to be aligned, not the whole array!
You need to define the struct runqueue to be the cacheline aligned
(using ____cacheline_aligned since it's a type), THEN put the
__cacheline_aligned after the array declaration so it gets put in the
aligned section:
struct runqueue {
spinlock_t lock;
unsigned long nr_running, nr_switches;
task_t *curr, *idle;
prio_array_t *active, *expired, arrays[2];
int prev_nr_running[NR_CPUS];
} ____cacheline_aligned;
static struct runqueue runqueues [NR_CPUS] __cacheline_aligned;
This is why my __per_cpu patch was invented 8)
Cheers,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
next parent reply other threads:[~2002-01-10 5:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.33.0201091126520.2276-100000@localhost.localdomain>
2002-01-10 3:48 ` Rusty Russell [this message]
2002-01-10 6:06 ` Davide Libenzi
2002-01-10 13:07 ` 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=E16OWCo-0000YO-00@wagner.rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--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 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®