mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-06 19:20:09 +00:00
lx_emul: handle page refcount
This commit is contained in:
parent
4474460377
commit
fd8df3a623
@ -46,6 +46,9 @@ void __free_pages(struct page * page, unsigned int order)
|
|||||||
unsigned const num_pages = (1 << order);
|
unsigned const num_pages = (1 << order);
|
||||||
void * const virt_addr = page->virtual;
|
void * const virt_addr = page->virtual;
|
||||||
|
|
||||||
|
if (atomic_read(&page->_refcount) && !atomic_dec_and_test(&page->_refcount))
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0; i < num_pages; i++)
|
for (i = 0; i < num_pages; i++)
|
||||||
lx_emul_disassociate_page_from_virt_addr(page[i].virtual);
|
lx_emul_disassociate_page_from_virt_addr(page[i].virtual);
|
||||||
|
|
||||||
@ -66,6 +69,8 @@ struct page * __alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid,
|
|||||||
void const *ptr = lx_emul_mem_alloc_aligned(PAGE_SIZE*nr_pages, PAGE_SIZE);
|
void const *ptr = lx_emul_mem_alloc_aligned(PAGE_SIZE*nr_pages, PAGE_SIZE);
|
||||||
struct page *page = lx_emul_virt_to_pages(ptr, nr_pages);
|
struct page *page = lx_emul_virt_to_pages(ptr, nr_pages);
|
||||||
|
|
||||||
|
atomic_set(&page->_refcount, 1);
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user