Home | History | Annotate | Download | only in wtf

Lines Matching refs:page

72 // - Each partition page (which is usually multiple physical pages) has a
120 // guard pages, metadata, page headers and wasted space come out of the total.
130 // for a partition page to be based on multiple system pages. Most references to
131 // "page" refer to partition pages.
134 // and include space for a small amount of metadata per partition page.
139 // system page of the span. For our current max slot span size of 64k and other
141 // against the end of a system page.
149 // freelist sections gradually, in units of the dominant system page size.
150 // What we're actually doing is avoiding filling the full partition page
152 // pointers will fault and dirty a private page, which is very wasteful if we
168 static const size_t kPageMetadataShift = 5; // 32 bytes per partition page.
208 // Some notes on page states. A page can be in one of three major states:
212 // An active page has available free slots. A full page has no free slots. A
213 // free page has had its backing memory released back to the system.
214 // There are two linked lists tracking the pages. The "active page" list is an
217 // scan over it. The "free page" list is an accurate list of pages which have
219 // The significant page transitions are:
220 // - free() will detect when a full page has a slot free()'d and immediately
221 // return the page to the head of the active list.
222 // - free() will detect when a page is fully emptied. It _may_ add it to the
224 // - malloc() _may_ scan the active page list in order to fulfil the request.
226 // active list. If there are no suitable active pages found, a free page (if one
232 int16_t numAllocatedSlots; // Deliberately signed, -1 for free page, -n for full pages.
385 // The metadata area is exactly one system page (the guard page) into the
386 // super page.
395 // Index 0 is invalid because it is the metadata area and the last index is invalid because it is a guard page.
398 PartitionPage* page = reinterpret_cast<PartitionPage*>(partitionSuperPageToMetadataArea(superPagePtr) + (partitionPageIndex << kPageMetadataShift));
399 // Many partition pages can share the same page object. Adjust for that.
400 size_t delta = page->pageOffset << kPageMetadataShift;
401 page = reinterpret_cast<PartitionPage*>(reinterpret_cast<char*>(page) - delta);
402 return page;
405 ALWAYS_INLINE void* partitionPageToPointer(PartitionPage* page)
407 uintptr_t pointerAsUint = reinterpret_cast<uintptr_t>(page);
412 // Index 0 is invalid because it is the metadata area and the last index is invalid because it is a guard page.
422 PartitionPage* page = partitionPointerToPageNoAlignmentCheck(ptr);
424 ASSERT(!((reinterpret_cast<uintptr_t>(ptr) - reinterpret_cast<uintptr_t>(partitionPageToPointer(page))) % page->bucket->slotSize));
425 return page;
428 ALWAYS_INLINE PartitionRootBase* partitionPageToRoot(PartitionPage* page)
430 PartitionSuperPageExtentEntry* extentEntry = reinterpret_cast<PartitionSuperPageExtentEntry*>(reinterpret_cast<uintptr_t>(page) & kSystemPageBaseMask);
436 PartitionPage* page = partitionPointerToPage(ptr);
437 PartitionRootBase* root = partitionPageToRoot(page);
443 PartitionPage* page = bucket->activePagesHead;
444 ASSERT(page->numAllocatedSlots >= 0);
445 void* ret = page->freelistHead;
450 page->freelistHead = newHead;
452 page->numAllocatedSlots++;
460 page = partitionPointerToPage(ret);
461 size_t bucketSize = page->bucket->slotSize;
488 ALWAYS_INLINE void partitionFreeWithPage(void* ptr, PartitionPage* page)
492 size_t bucketSize = page->bucket->slotSize;
497 ASSERT(page->numAllocatedSlots);
498 PartitionFreelistEntry* freelistHead = page->freelistHead;
504 page->freelistHead = entry;
505 --page->numAllocatedSlots;
506 if (UNLIKELY(page->numAllocatedSlots <= 0))
507 partitionFreeSlowPath(page);
517 PartitionPage* page = partitionPointerToPage(ptr);
518 partitionFreeWithPage(ptr, page);
569 PartitionPage* page = partitionPointerToPage(ptr);
571 partitionFreeWithPage(ptr, page);
626 PartitionPage* page = partitionPointerToPage(ptr);
627 size_t size = page->bucket->slotSize;