From eb313b410e0df742ad69f91173e26e356edd0d4f Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 2 Jun 2004 17:59:43 -0700 Subject: [PATCH] [PATCH] sched: balance-on-exec fix From: Jack Steiner It looks like the call to sched_balance_exec() from do_execve() is in the wrong spot. The code calls sched_balance_exec() before determining whether "filename" actually exists. In many cases, users have several entries in $PATH. If a full path name is not specified on the 'exec" call, the library code iterates thru the files in the PATH list until it finds the program. This can result is numerous migrations of the parent process before the program is actually found. Signed-off-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index 4b7f44fb49efb..f30b49540adbe 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1074,14 +1074,14 @@ int do_execve(char * filename, int retval; int i; - sched_balance_exec(); - file = open_exec(filename); retval = PTR_ERR(file); if (IS_ERR(file)) return retval; + sched_balance_exec(); + bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0])); -- 2.53.0