Changeset 41081 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Apr 27, 2012 12:06:14 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c
r40977 r41081 181 181 static page_t **rtR0MemObjSolPagesAlloc(uint64_t uPhysHi, uint64_t *puPhys, size_t cb) 182 182 { 183 /** @todo We need to satisfy the upper physical address constraint */184 185 183 /* 186 184 * The page freelist and cachelist both hold pages that are not mapped into any address space. … … 208 206 for (size_t i = 0; i < cPages; i++, virtAddr += PAGESIZE) 209 207 { 210 /* 211 * Get a page from the freelist or cachelist. 212 */ 213 page_t *pPage = rtR0MemObjSolPageFromFreelist(virtAddr, PAGESIZE); 214 if (!pPage) 208 uint32_t cTries = 3; 209 page_t *pPage = NULL; 210 while (cTries > 0) 215 211 { 216 pPage = rtR0MemObjSolPageFromCachelist(virtAddr, PAGESIZE); 217 if (RT_UNLIKELY(!pPage)) 212 /* 213 * Get a page from the freelist or cachelist & verify if it's within our 214 * requested range. 215 */ 216 pPage = rtR0MemObjSolPageFromFreelist(virtAddr, PAGESIZE); 217 if (!pPage) 218 218 { 219 /* 220 * No more pages found, release was grabbed so far. 221 */ 222 page_create_putback(cPages - i); 223 while (--i >= 0) 224 page_free(ppPages[i], 0 /* don't need page, move to tail of pagelist */); 225 kmem_free(ppPages, cbPages); 226 page_unresv(cPages); 227 return NULL; 219 pPage = rtR0MemObjSolPageFromCachelist(virtAddr, PAGESIZE); 220 if (RT_UNLIKELY(!pPage)) 221 break; 228 222 } 223 if (uPhysHi != NIL_RTHCPHYS) 224 { 225 uint64_t uPhys = rtR0MemObjSolPagePhys(pPage); 226 if (uPhys > uPhysHi) 227 { 228 page_free(pPage, 0 /* don't need page, move to tail of pagelist */); 229 pPage = NULL; 230 --cTries; 231 continue; 232 } 233 } 234 235 PP_CLRFREE(pPage); /* Page is no longer free */ 236 PP_CLRAGED(pPage); /* Page is not hashed in */ 237 ppPages[i] = pPage; 238 break; 229 239 } 230 240 231 PP_CLRFREE(pPage); /* Page is no longer free */ 232 PP_CLRAGED(pPage); /* Page is not hashed in */ 233 ppPages[i] = pPage; 241 if (RT_UNLIKELY(!pPage)) 242 { 243 /* 244 * No pages found or found pages didn't meet requirements, release what was grabbed so far. 245 */ 246 page_create_putback(cPages - i); 247 while (--i >= 0) 248 page_free(ppPages[i], 0 /* don't need page, move to tail of pagelist */); 249 kmem_free(ppPages, cbPages); 250 page_unresv(cPages); 251 return NULL; 252 } 234 253 } 235 254 … … 273 292 /* 274 293 * Prepare pages for mapping into kernel/user-space. Downgrade the 275 * exclusive page lock to a shared lock if necessary.294 * exclusive page lock to a shared lock to prevent page relocation. 276 295 */ 277 296 if (page_tryupgrade(ppPages[iPage]) == 1) … … 407 426 /* 408 427 * We need to downgrade the sub-pages from exclusive to shared locking 409 * because otherweise we cannot <you go figure>.428 * to prevent page relocation. 410 429 */ 411 430 for (pgcnt_t iPage = 0; iPage < cPages; iPage++)
Note:
See TracChangeset
for help on using the changeset viewer.