VirtualBox

Changeset 16464 in vbox


Ignore:
Timestamp:
Feb 2, 2009 2:53:14 PM (16 years ago)
Author:
vboxsync
Message:

set VM_LOCKED to pin pages allocated with mmap()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c

    r14824 r16464  
    744744        {
    745745            /*
    746              * Flush dcache (required?) and protect against fork.
     746             * Flush dcache (required?), protect against fork and _really_ pin the page
     747             * table entries. get_user_pages() will protect against swapping out the
     748             * pages but it will NOT protect against removing page table entries. This
     749             * can be achieved with
     750             *   - using mlock / mmap(..., MAP_LOCKED, ...) from userland. This requires
     751             *     an appropriate limit set up with setrlimit(..., RLIMIT_MEMLOCK, ...).
     752             *     Usual Linux distributions support only a limited size of locked pages
     753             *     (e.g. 32KB).
     754             *   - setting the PageReserved bit (as we do in rtR0MemObjLinuxAllocPages()
     755             *     or by
     756             *   - setting the VM_LOCKED flag. This is the same as doing mlock() without
     757             *     a range check.
    747758             */
    748759            /** @todo The Linux fork() protection will require more work if this API
     
    751762            {
    752763                flush_dcache_page(pMemLnx->apPages[rc]);
    753                 papVMAs[rc]->vm_flags |= VM_DONTCOPY;
     764                papVMAs[rc]->vm_flags |= (VM_DONTCOPY | VM_LOCKED);
    754765            }
    755766
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette