diff options
author | Roland McGrath <roland@redhat.com> | 2010-09-07 22:36:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-09-10 11:10:26 -0400 |
commit | 7993bc1f4663c0db67bb8f0d98e6678145b387cd (patch) | |
tree | d283304f635cc5c36d8fa3319dd663209138988e | |
parent | 1b528181b2ffa14721fb28ad1bd539fe1732c583 (diff) |
execve: improve interactivity with large arguments
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 <roland@redhat.com>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/exec.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -419,6 +419,8 @@ static int copy_strings(int argc, const char __user *const __user *argv, | |||
419 | while (len > 0) { | 419 | while (len > 0) { |
420 | int offset, bytes_to_copy; | 420 | int offset, bytes_to_copy; |
421 | 421 | ||
422 | cond_resched(); | ||
423 | |||
422 | offset = pos % PAGE_SIZE; | 424 | offset = pos % PAGE_SIZE; |
423 | if (offset == 0) | 425 | if (offset == 0) |
424 | offset = PAGE_SIZE; | 426 | offset = PAGE_SIZE; |