Lines Matching refs:page
113 struct page *first_page;
227 * allocate and initialize struct page for the device memory. More-
440 * @pfn: page frame number to lookup page_map
471 void free_zone_device_page(struct page *page)
473 if (WARN_ON_ONCE(!page->pgmap->ops || !page->pgmap->ops->page_free))
476 mem_cgroup_uncharge(page_folio(page));
483 VM_BUG_ON_PAGE(PageAnon(page) && PageCompound(page), page);
484 if (PageAnon(page))
485 __ClearPageAnonExclusive(page);
488 * When a device managed page is freed, the page->mapping field
490 * lower bits of page->mapping may still identify the page as an
491 * anonymous page. Ultimately, this entire field is just stale
499 * ...checks page->mapping, via PageAnon(page) call,
500 * and incorrectly concludes that the page is an
501 * anonymous page. Therefore, it incorrectly,
506 * to clear page->mapping.
508 page->mapping = NULL;
509 page->pgmap->ops->page_free(page);
511 if (page->pgmap->type != MEMORY_DEVICE_PRIVATE &&
512 page->pgmap->type != MEMORY_DEVICE_COHERENT)
514 * Reset the page count to 1 to prepare for handing out the page
517 set_page_count(page, 1);
519 put_dev_pagemap(page->pgmap);
522 void zone_device_page_init(struct page *page)
528 WARN_ON_ONCE(!percpu_ref_tryget_live(&page->pgmap->ref));
529 set_page_count(page, 1);
530 lock_page(page);
535 bool __put_devmap_managed_page_refs(struct page *page, int refs)
537 if (page->pgmap->type != MEMORY_DEVICE_FS_DAX)
541 * fsdax page refcounts are 1-based, rather than 0-based: if
542 * refcount is 1, then the page is free and the refcount is
543 * stable because nobody holds a reference on the page.
545 if (page_ref_sub_return(page, refs) == 1)
546 wake_up_var(&page->_refcount);