lkml.org 
[lkml]   [2009]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -v5][RFC]: mutex: implement adaptive spinning
> But we can do that with __get_user(thread_info->cpu) (very unlikely page 
> fault protection due to the possibility of CONFIG_DEBUG_PAGEALLOC) and
> then validating the cpu. It it's in range, we can use it and verify
> whether cpu_rq(cpu)->curr has that thread_info.
>
> So we can do all that locklessly and optimistically, just going back and
> verifying the results later. This is why "thread_info" is actually a
> better thing to use than "task_struct" - we can look up the cpu in it with
> a simple dereference. We knew the pointer _used_ to be valid, so in any
> normal situation, it will never page fault (and if you have
> CONFIG_DEBUG_PAGEALLOC and hit a very unlucky race, then performance isn't
> your concern anyway: we just need to make the page fault be non-lethal ;)

The problem with probe_kernel_address() is that it does lots of
operations around the access in the hot path (set_fs, pagefault_disable etc.),
so i'm not sure that's a good idea.

Sure you can probably do better, but that would involve
patching all architectures won't it? Ok I suppose
you could make an ARCH_HAS_blabla white list, but that
wouldn't be exactly pretty.

-Andi


\
 
 \ /
  Last update: 2009-01-07 22:27    [W:0.174 / U:0.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site