git: pthreads and kernel - change MAP_STACK operation

Matthew Dillon dillon at crater.dragonflybsd.org
Thu May 2 21:39:33 PDT 2019


commit 4837705ef8eed5e115acd4998b8f162b32e6a6f9
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Thu May 2 19:48:53 2019 -0700

    pthreads and kernel - change MAP_STACK operation
    
    * Only allow new mmap()'s to intrude on ungrown MAP_STACK areas when
      MAP_TRYFIXED is specified.  This was not working as intended before.
      Adjust the manual page to be more clear.
    
    * Make kern.maxssiz (the maximum user stack size) visible via sysctl.
    
    * Add kern.maxthrssiz, indicating the approximate space for placement
      of pthread stacks.  This defaults to 128GB.
    
    * The old libthread_xu stack code did use TRYFIXED and will work
      with the kernel changes, but change how it works to not assume
      that the user stack should suddenly be limited to the pthread stack
      size (~2MB).
    
      Just use a normal mmap() now without TRYFIXED and a hint based on
      kern.maxthrssiz (defaults to 512GB), calculating a starting address
      hint that is (_usrstack - maxssiz - maxthrssiz).
    
    * Adjust procfs to report MAP_STACK segments as 'STK'.

Summary of changes:
 lib/libc/sys/mmap.2                      |  20 ++----
 lib/libthread_xu/thread/thr_stack.c      | 114 ++++++++++---------------------
 sys/kern/subr_param.c                    |  11 ++-
 sys/platform/pc64/include/vmparam.h      |   3 +
 sys/platform/vkernel64/include/vmparam.h |   3 +
 sys/vfs/procfs/procfs_map.c              |  13 ++--
 sys/vm/vm_map.c                          |   6 +-
 7 files changed, 68 insertions(+), 102 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/4837705ef8eed5e115acd4998b8f162b32e6a6f9


-- 
DragonFly BSD source repository


More information about the Commits mailing list