Re: [GIT PULL] core kernel fixes

From: Linus Torvalds
Date: Sun Jun 21 2009 - 13:37:32 EST

On Sun, 21 Jun 2009, Thomas Gleixner wrote:
> Hmm. The main reason why we switched to get_user_pages_fast() in the
> futex code is to avoid mmap_sem contention which was observed as a
> real big performance problem especially with those horrible JavaVM
> applications.

Not relevant.

get_user_pages_fast() takes the mmap_sem for the case where it needs to
fault things in too.

So assuming the _only_ reason this thing is called is because we failed
earlier when doing the futex_atomic_op_inuser(), then you're basically
guaranteed that the "fast" case of get_user_pages_fast() is never actually
taken, since we already know that the page tables aren't amenable to an
atomic access.

And as far as I can tell, that is indeed the only case where you use that
'get_user_writeable()' thing. You've had futex_atomic_op_inuser() fail,
and need to repeat. No?

> As a fallout of this we got rid of the private find_vma /
> handle_mm_fault magic (as above) in the futex code which mm folks
> frowned upon for quite a while. Unfortunately we got it wrong :(

Sure. But "get_user_pages_fast()" really is the wrong thing. You're not at
all interested in the user pages. You're interested in making sure that
the page is atomically writable, and nothing else. Right?

Which is why I said that "lock ; addl $0,(mem)" would be a _single_
instruction, and do everything that your "get_user_pages_fast()" hack
would do. If the fault is unlikely, that would be a better operation. I
just don't think the fault is unlikely, I suspect it happens every time.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at