Skip to content

Commit

Permalink
execve: improve interactivity with large arguments
Browse files Browse the repository at this point in the history
commit 7993bc1 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 <roland@redhat.com>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Roland McGrath authored and Greg Kroah-Hartman committed Oct 29, 2010
1 parent 8816b5d commit bd720c9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,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;
Expand Down

0 comments on commit bd720c9

Please sign in to comment.