From c43990162fc7f9d2f15a12797fdc6f9c0905f704 Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Sun, 15 Jul 2007 23:38:56 -0700 Subject: uml: simplify helper stack handling run_helper and run_helper_thread had arguments which were the same in all callers. run_helper's stack_out was always NULL and run_helper_thread's stack_order was always 0. These are now gone, and the constants folded into the code. Also fixed leaks of the helper stack in the AIO and SIGIO code. Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/os-Linux/aio.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'arch/um/os-Linux/aio.c') diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c index 9bf944f6a1db..b126df4ea168 100644 --- a/arch/um/os-Linux/aio.c +++ b/arch/um/os-Linux/aio.c @@ -177,6 +177,7 @@ static int do_not_aio(struct aio_thread_req *req) static int aio_req_fd_r = -1; static int aio_req_fd_w = -1; static int aio_pid = -1; +static unsigned long aio_stack; static int not_aio_thread(void *arg) { @@ -212,7 +213,6 @@ static int not_aio_thread(void *arg) static int init_aio_24(void) { - unsigned long stack; int fds[2], err; err = os_pipe(fds, 1, 1); @@ -227,7 +227,7 @@ static int init_aio_24(void) goto out_close_pipe; err = run_helper_thread(not_aio_thread, NULL, - CLONE_FILES | CLONE_VM | SIGCHLD, &stack, 0); + CLONE_FILES | CLONE_VM | SIGCHLD, &aio_stack); if(err < 0) goto out_close_pipe; @@ -252,7 +252,6 @@ out: #define DEFAULT_24_AIO 0 static int init_aio_26(void) { - unsigned long stack; int err; if(io_setup(256, &ctx)){ @@ -263,7 +262,7 @@ static int init_aio_26(void) } err = run_helper_thread(aio_thread, NULL, - CLONE_FILES | CLONE_VM | SIGCHLD, &stack, 0); + CLONE_FILES | CLONE_VM | SIGCHLD, &aio_stack); if(err < 0) return err; @@ -365,8 +364,10 @@ __initcall(init_aio); static void exit_aio(void) { - if(aio_pid != -1) + if (aio_pid != -1) { os_kill_process(aio_pid, 1); + free_stack(aio_stack, 0); + } } __uml_exitcall(exit_aio); -- cgit v1.2.3-55-g7522