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.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37203 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-06-21 18:22:42 +00:00
parent ae531e279d
commit 91af25d302
+12 -1
View File
@@ -1096,8 +1096,11 @@ vm_create_anonymous_area(team_id team, const char *name, addr_t size,
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 @@ vm_create_anonymous_area(team_id team, const char *name, addr_t size,
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;