Introduced vm_page_try_reserve_pages(), which fails when not enough
pages are free ATM. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27116 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
cc57c65424
commit
2e8e6c9c6e
@ -46,6 +46,7 @@ void vm_page_schedule_write_page_range(struct VMCache *cache,
|
||||
|
||||
void vm_page_unreserve_pages(uint32 count);
|
||||
void vm_page_reserve_pages(uint32 count);
|
||||
bool vm_page_try_reserve_pages(uint32 count);
|
||||
|
||||
struct vm_page *vm_page_allocate_page(int pageState, bool reserved);
|
||||
status_t vm_page_allocate_pages(int pageState, struct vm_page **pages,
|
||||
|
@ -1756,6 +1756,25 @@ vm_page_reserve_pages(uint32 count)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
vm_page_try_reserve_pages(uint32 count)
|
||||
{
|
||||
if (count == 0)
|
||||
return true;
|
||||
|
||||
InterruptsSpinLocker locker(sPageLock);
|
||||
|
||||
T(ReservePages(count));
|
||||
|
||||
size_t freePages = free_page_queue_count();
|
||||
if (sReservedPages + count > freePages)
|
||||
return false;
|
||||
|
||||
sReservedPages += count;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
vm_page *
|
||||
vm_page_allocate_page(int pageState, bool reserved)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user