why allocate page for stack in clone(, stack, ~CLONE_VM & (...)) ?
In arch/um/os/start_up.c, function start_ptraced_child() does:
pid = clone(ptrace_child, (void *) sp, SIGCHLD, NULL);
where sp points into a newly- mmap()ed page. Instead, why not
avoid the mmap() entirely via:
pid = clone(ptrace_child, NULL, SIGCHLD, NULL);Because the flags to clone() do not contain CLONE_VM, then the clone() is equivalent to a fork() with respect to address space. The child does not share VM with the parent, and using the same addresses for the stack causes no overwrites. Perhaps the Dcache efficiency is slightly less, but much less costly than mmap() and the eventual munmap().
Signature · 11 lines
John Reiser, [email protected] ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 8 lines · John Reiser
In
arch/um/os/start_up.c, functionstart_ptraced_child()does:pid = clone(ptrace_child, (void *) sp, SIGCHLD, NULL); where sp points into a newly- mmap()ed page. Instead, why not avoid the mmap() entirely via: pid = clone(ptrace_child, NULL, SIGCHLD, NULL);Because the flags to
clone()do not containCLONE_VM, then theclone()is equivalent to afork()with respect to address space.
If you look at what's currently in mainline, you'll see it does exactly what you suggest - the patch in question is this one:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=3cdaf45578b9aa1eb748d0a32678ee5a0180575b Jeff
Signature · 11 lines
Work email - jdike at linux dot intel dot com ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel