Re: [PATCH -v5][RFC]: mutex: implement adaptive spinning

Andrew Morton
2009-01-07T21:48:07Z

On Wed, 7 Jan 2009 22:32:22 +0100
Ingo Molnar <mingo@elte.hu> wrote:

> > We could do the whole "oldfs = get_fs(); set_fs(KERNEL_DS); ..
> > set_fs(oldfs);" crud, but it would probably be better to just add an
> > architected accessor. Especially since it's going to generally just be a
> >
> > #define get_kernel_careful(val,p) __get_user(val,p)
> >
> > for most architectures.
> >
> > We've needed that before (and yes, we've simply mis-used __get_user() on
> > x86 before rather than add it).
>
> for the oldfs stuff we already have probe_kernel_read(). OTOH, that
> involves pagefault_disable() which is an atomic op

tisn't. pagefault_disable() is just preempt_count()+=1;barrier() ?

Am suspecting that you guys might be over-optimising this
contended-path-were-going-to-spin-anyway code?