Author: bonefish Date: 2010-06-21 20:22:42 +0200 (Mon, 21 Jun 2010) New Revision: 37203 Changeset: http://dev.haiku-os.org/changeset/37203/haiku Modified: haiku/trunk/src/system/kernel/vm/vm.cpp Log: vm_create_anonymous_area(): * Fixed check: If a low *or* high address restriction is given, we need to force B_CONTIGUOUS wiring. * Optimization: Contiguous single-page allocation can be allocated as full-lock, if the no low/high address restrictions are given. Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2010-06-21 17:15:52 UTC (rev 37202) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2010-06-21 18:22:42 UTC (rev 37203) @@ -1096,8 +1096,11 @@ return B_BAD_VALUE; } + // If low or high physical address restrictions are given, we force + // B_CONTIGUOUS wiring, since only then we'll use + // vm_page_allocate_page_run() which deals with those restrictions. if (physicalAddressRestrictions->low_address != 0 - && physicalAddressRestrictions->high_address != 0) { + || physicalAddressRestrictions->high_address != 0) { wiring = B_CONTIGUOUS; } @@ -1137,6 +1140,14 @@ return B_BAD_VALUE; } + // Optimization: For a single-page contiguous allocation without low/high + // memory restriction B_FULL_LOCK wiring suffices. + if (wiring == B_CONTIGUOUS && size == B_PAGE_SIZE + && physicalAddressRestrictions->low_address == 0 + && physicalAddressRestrictions->high_address == 0) { + wiring = B_FULL_LOCK; + } + // For full lock or contiguous areas we're also going to map the pages and // thus need to reserve pages for the mapping backend upfront. addr_t reservedMapPages = 0;