[PATCH] i386: Remove redundant might_sleep() in user accessors.

From: Vadim Lobanov
Date: Tue Jul 11 2006 - 01:52:14 EST


Hi,

On i386, the user space accessor functions copy_from/to_user() both
invoke might_sleep(), do a quick sanity check, and then pass the work on
to their __copy_from/to_user() counterparts, which again invoke
might_sleep(). Given that no actual work happens between these two
calls, it is best to eliminate one of the redundant might_sleep()s.

Please apply.

Signed-off-by: Vadim Lobanov <vlobanov@xxxxxxxxxxxxx>

diff -Npru linux-2.6.18-rc1/arch/i386/lib/usercopy.c linux-new/arch/i386/lib/usercopy.c
--- linux-2.6.18-rc1/arch/i386/lib/usercopy.c 2006-07-06 20:20:55.000000000 -0700
+++ linux-new/arch/i386/lib/usercopy.c 2006-07-10 19:03:47.000000000 -0700
@@ -843,7 +843,6 @@ unsigned long __copy_from_user_ll_nocach
unsigned long
copy_to_user(void __user *to, const void *from, unsigned long n)
{
- might_sleep();
BUG_ON((long) n < 0);
if (access_ok(VERIFY_WRITE, to, n))
n = __copy_to_user(to, from, n);
@@ -870,7 +869,6 @@ EXPORT_SYMBOL(copy_to_user);
unsigned long
copy_from_user(void *to, const void __user *from, unsigned long n)
{
- might_sleep();
BUG_ON((long) n < 0);
if (access_ok(VERIFY_READ, from, n))
n = __copy_from_user(to, from, n);
-
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/