Re: [Bug 350] New: i386 context switch very slow compared to 2.4 due to wrmsr (performance)

Jamie Lokier (jamie@shareable.org)
Wed, 12 Feb 2003 10:27:41 +0000


Andi Kleen wrote:
> + /* FIXME should disable preemption here but how can we reenable it? */
> +
> + enable_sysenter();
> +

Try this:

1. Disable preemption in do_sys_vm86(), at the same place as
disable_sysenter() is called.

2. Enable preemption in save_v86_state(), and put the call
to enable_sysenter() there.

3. In restore_sigcontext() [signal.c], _iff_ the VM flag
is set in the restored context, call disable_sysenter()
and also disable preemption.

That should make vm86 simply disable preemption while it is activated.
It is not as nice as actually being preemptible, but safe first,
optimise later.

The return path to vm86 mode has the peculiar property of not doing
the need_resched test, unlike the return path to normal user space,
which is a boon here.

-- Jamie

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