Commit eb313b41 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] sched: balance-on-exec fix

From: Jack Steiner <steiner@sgi.com>

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: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ce247d90
...@@ -1074,14 +1074,14 @@ int do_execve(char * filename, ...@@ -1074,14 +1074,14 @@ int do_execve(char * filename,
int retval; int retval;
int i; int i;
sched_balance_exec();
file = open_exec(filename); file = open_exec(filename);
retval = PTR_ERR(file); retval = PTR_ERR(file);
if (IS_ERR(file)) if (IS_ERR(file))
return retval; return retval;
sched_balance_exec();
bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0])); memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0]));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment