From: Roland McGrath Date: Wed, 8 Sep 2010 02:36:28 +0000 (-0700) Subject: execve: improve interactivity with large arguments X-Git-Tag: v2.6.33.8~433 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=43bcb928c27f7a0fc53b95fac85354ee73b6cd1b;p=karo-tx-linux.git execve: improve interactivity with large arguments commit 7993bc1f4663c0db67bb8f0d98e6678145b387cd upstream. This adds a preemption point during the copying of the argument and environment strings for execve, in copy_strings(). There is already a preemption point in the count() loop, so this doesn't add any new points in the abstract sense. When the total argument+environment strings are very large, the time spent copying them can be much more than a normal user time slice. So this change improves the interactivity of the rest of the system when one process is doing an execve with very large arguments. Signed-off-by: Roland McGrath Reviewed-by: KOSAKI Motohiro Signed-off-by: Linus Torvalds Cc: Chuck Ebbert Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/exec.c b/fs/exec.c index 8fc4e4099cdd..982c3c8473c0 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -418,6 +418,8 @@ static int copy_strings(int argc, char __user * __user * argv, while (len > 0) { int offset, bytes_to_copy; + cond_resched(); + offset = pos % PAGE_SIZE; if (offset == 0) offset = PAGE_SIZE;