Ok, this time for sure... version 3 of the MAP_GUARDED patch is out.

        http://www.backplane.com/FreeBSD4/
        http://www.backplane.com/FreeBSD4/guard-3.diff
        http://www.backplane.com/FreeBSD4/guard3.c

    MAP_GUARDED

        mmap(addr/NULL, len, prot, MAP_GUARDED, fd, offset)

        The offset field specifies the number of bytes at the base of the 
        returned map which are guarded and should be a multiple of the
        system page size.

        Pages at the end of the map are not guarded (any more).

    MAP_STACK

        Works as per normal except that the per-process stack resource limit
        applies to each mmap() separately.

    MAP_GUARDED|MAP_STACK

        Useful combination to place guard page(s) at the beginning of a 
        thread stack.


    Also in this patch set I optimized vm_map_entry creation during normal
    stack growth operations.  Normally the system tries to chunk vm_map_entry
    allocation for stacks by SGROWSIZ, which is typically 128K.  But
    now the vm_map_entry_insert() optimization is able to optimize standard
    stack growth, which means that the actual vm_map_entry creation is 
    governed by the more generous vm.map_entry_blk_opt value (512K by default).

    I like this implementation a lot better.  By removing the guard pages at
    the end of the map MAP_GUARDED|MAP_STACK operation is much, much more
    intuitive.  You don't have to do a blessed thing to the threading code
    except change MAP_STACK to MAP_STACK|MAP_GUARDED, and bump up the size
    of the mmap() allocation to include what used to be the skipped 'dead'
    page.

                                        -Matt
                                        Matthew Dillon 
                                        <[EMAIL PROTECTED]>


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to