Re: [patch] sched: unlocked context-switches

From: Nick Piggin
Date: Sat Apr 09 2005 - 01:30:36 EST


Ingo Molnar wrote:
* Luck, Tony <tony.luck@xxxxxxxxx> wrote:


tested on x86, and all other arches should work as well, but if an architecture has irqs-off assumptions in its switch_to() logic it might break. (I havent found any but there may such assumptions.)

The ia64_switch_to() code includes a section that can change a pinned
MMU mapping (when the stack for the new process is in a different
granule from the stack for the old process). [...]


thanks - updated patch below. Any other architectures that switch the kernel stack in a nonatomic way? x86/x64 switches it atomically.


Well that does look like a pretty good cleanup. It certainly is
the final step in freeing complex architecture switching code
from entanglement with scheduler internal locking, and unifies
the locking scheme.

I did propose doing unconditionally unlocked switches a while
back when my patch first popped up - you were against it then,
but I guess you've had second thoughts?

It does add an extra couple of stores to on_cpu, and a wmb()
for architectures that didn't previously need the unlocked
switches. And ia64 needs the extra interrupt disable / enable.
Probably worth it?

Minor style request: I like that you're accessing ->on_cpu
through functions so the !SMP case doesn't clutter the code
with ifdefs... but can you do set_task_on_cpu(p) and
clear_task_on_cpu(p) ?

Thanks.

--
SUSE Labs, Novell Inc.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/