Lines Matching refs:refs
32 static void hpage_pincount_add(struct page *page, int refs) in hpage_pincount_add() argument
37 atomic_add(refs, compound_pincount_ptr(page)); in hpage_pincount_add()
40 static void hpage_pincount_sub(struct page *page, int refs) in hpage_pincount_sub() argument
45 atomic_sub(refs, compound_pincount_ptr(page)); in hpage_pincount_sub()
49 static void put_page_refs(struct page *page, int refs) in put_page_refs() argument
52 if (VM_WARN_ON_ONCE_PAGE(page_ref_count(page) < refs, page)) in put_page_refs()
60 if (refs > 1) in put_page_refs()
61 page_ref_sub(page, refs - 1); in put_page_refs()
69 static inline struct page *try_get_compound_head(struct page *page, int refs) in try_get_compound_head() argument
75 if (unlikely(!page_cache_add_speculative(head, refs))) in try_get_compound_head()
88 put_page_refs(head, refs); in try_get_compound_head()
128 int refs, unsigned int flags) in try_grab_compound_head() argument
131 return try_get_compound_head(page, refs); in try_grab_compound_head()
146 page = try_get_compound_head(page, refs); in try_grab_compound_head()
161 hpage_pincount_add(page, refs); in try_grab_compound_head()
163 page_ref_add(page, refs * (GUP_PIN_COUNTING_BIAS - 1)); in try_grab_compound_head()
166 refs); in try_grab_compound_head()
175 static void put_compound_head(struct page *page, int refs, unsigned int flags) in put_compound_head() argument
179 refs); in put_compound_head()
182 hpage_pincount_sub(page, refs); in put_compound_head()
184 refs *= GUP_PIN_COUNTING_BIAS; in put_compound_head()
187 put_page_refs(page, refs); in put_compound_head()
2470 int refs; in gup_hugepte() local
2486 refs = record_subpages(page, addr, end, pages + *nr); in gup_hugepte()
2488 head = try_grab_compound_head(head, refs, flags); in gup_hugepte()
2493 put_compound_head(head, refs, flags); in gup_hugepte()
2497 *nr += refs; in gup_hugepte()
2533 int refs; in gup_huge_pmd() local
2546 refs = record_subpages(page, addr, end, pages + *nr); in gup_huge_pmd()
2548 head = try_grab_compound_head(pmd_page(orig), refs, flags); in gup_huge_pmd()
2553 put_compound_head(head, refs, flags); in gup_huge_pmd()
2557 *nr += refs; in gup_huge_pmd()
2567 int refs; in gup_huge_pud() local
2580 refs = record_subpages(page, addr, end, pages + *nr); in gup_huge_pud()
2582 head = try_grab_compound_head(pud_page(orig), refs, flags); in gup_huge_pud()
2587 put_compound_head(head, refs, flags); in gup_huge_pud()
2591 *nr += refs; in gup_huge_pud()
2600 int refs; in gup_huge_pgd() local
2609 refs = record_subpages(page, addr, end, pages + *nr); in gup_huge_pgd()
2611 head = try_grab_compound_head(pgd_page(orig), refs, flags); in gup_huge_pgd()
2616 put_compound_head(head, refs, flags); in gup_huge_pgd()
2620 *nr += refs; in gup_huge_pgd()