This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] posix: Optimize Linux posix_spawn
- From: Florian Weimer <fweimer at redhat dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 07 May 2019 10:33:04 +0200
- Subject: Re: [PATCH] posix: Optimize Linux posix_spawn
- References: <20190506193119.20505-1-adhemerval.zanella@linaro.org>
* Adhemerval Zanella:
> The current internal posix_spawn symbol for Linux (__spawni) requires
> to allocate a dynamic stack based on input arguments to handle the
> SPAWN_XFLAGS_USE_PATH internal flag, which re-issue the input binary
> as a shell script if execve call return ENOEXEC (to execute shell
> scripts with an initial shebang).
>
> This is done only for compatibility mode and the generic case does not
> require the extra calculation plus the potential large mmap/munmap
> call. For default case, a pre-defined buffer is sufficed to use on the
> clone call instead.
>
> This patch optimizes Linux spawni by allocating a dynamic stack only
> for compatibility symbol (SPAWN_XFLAGS_USE_PATH). For generic case,
> a stack allocated buffer is used instead.
I'm still not convinced that stack switching is required here.
Thanks,
Florian