Re: [GIT PULL] core kernel fixes
From: Linus Torvalds
Date: Sun Jun 21 2009 - 13:58:03 EST
On Sun, 21 Jun 2009, Linus Torvalds wrote:
> 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?
I just checked. Yes, this code is _only_ entered when an atomic op
returned EFAULT. IOW, we absolutely know that the page tables are not set
up for writability, and thus that the "fast" case will never ever trigger.
(Ok, in theory you could have some other thread writing to that page at
the same time and handle the page fault and making it writable, but in
practice that's not really relevant).
So just doing a "make_sure_its_writable()" and using handle_fault() is the
right thing to do. Because it's what get_user_fast() would have done too,
except it would have gone through first the fast case, and failed, then
the slow case, and failed the lookup there, and then the slow case would
have done that handle_mm_fault() in the end anyway.
In fact, since you're not actually interested in the page, you _could_
get_user_pages(tsk, mm, uaddr, 4, 1, 0, NULL, NULL);
where a NULL "pages" pointer already tells get_user_pages() that you're
That's at least cleaner than doing a "gup_fast()" (which isn't fast), and
then freeing the page that you weren't even interested in.
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/