Lines Matching full:page
11 * The page_pool allocator is optimized for recycling page or page fragment used
15 * which allocate memory with or without page splitting depending on the
19 * always smaller than half a page, it can use one of the more specific API
22 * 1. page_pool_alloc_pages(): allocate memory without page splitting when
23 * driver knows that the memory it need is always bigger than half of the page
24 * allocated from page pool. There is no cache line dirtying for 'struct page'
25 * when a page is recycled back to the page pool.
27 * 2. page_pool_alloc_frag(): allocate memory with page splitting when driver
29 * page allocated from page pool. Page splitting enables memory saving and thus
31 * implement page splitting, mainly some cache line dirtying/bouncing for
32 * 'struct page' and atomic operation for page->pp_ref_count.
40 * page_pool_put_page() may be called multiple times on the same page if a page
42 * recycle the page, or in case of page->_refcount > 1, it will release the DMA
48 * the same page when a page is split. The API user must setup pool->p.max_len
87 * page_pool_dev_alloc_pages() - allocate a page.
90 * Get a page from the page allocator or page_pool caches.
92 static inline struct page *page_pool_dev_alloc_pages(struct page_pool *pool) in page_pool_dev_alloc_pages()
100 * page_pool_dev_alloc_frag() - allocate a page fragment.
102 * @offset: offset to the allocated page
105 * Get a page fragment from the page allocator or page_pool caches.
108 * Return allocated page fragment, otherwise return NULL.
110 static inline struct page *page_pool_dev_alloc_frag(struct page_pool *pool, in page_pool_dev_alloc_frag()
119 static inline struct page *page_pool_alloc(struct page_pool *pool, in page_pool_alloc()
124 struct page *page; in page_pool_alloc() local
132 page = page_pool_alloc_frag(pool, offset, *size, gfp); in page_pool_alloc()
133 if (unlikely(!page)) in page_pool_alloc()
145 return page; in page_pool_alloc()
149 * page_pool_dev_alloc() - allocate a page or a page fragment.
151 * @offset: offset to the allocated page
154 * Get a page or a page fragment from the page allocator or page_pool caches
159 * Return allocated page or page fragment, otherwise return NULL.
161 static inline struct page *page_pool_dev_alloc(struct page_pool *pool, in page_pool_dev_alloc()
174 struct page *page; in page_pool_alloc_va() local
177 page = page_pool_alloc(pool, &offset, size, gfp & ~__GFP_HIGHMEM); in page_pool_alloc_va()
178 if (unlikely(!page)) in page_pool_alloc_va()
181 return page_address(page) + offset; in page_pool_alloc_va()
185 * page_pool_dev_alloc_va() - allocate a page or a page fragment and return its
191 * it returns va of the allocated page or page fragment.
194 * Return the va for the allocated page or page fragment, otherwise return NULL.
206 * @pool: pool from which page was allocated
223 * page_pool_fragment_page() - split a fresh page into fragments
224 * @page: page to split
227 * pp_ref_count represents the number of outstanding references to the page,
228 * which will be freed using page_pool APIs (rather than page allocator APIs
230 * objects like skbs marked for page pool recycling.
233 * freshly allocated page. The page must be freshly allocated (have a
240 static inline void page_pool_fragment_page(struct page *page, long nr) in page_pool_fragment_page() argument
242 page_pool_fragment_netmem(page_to_netmem(page), nr); in page_pool_fragment_page()
251 * references to the page: in page_pool_unref_netmem()
258 * an atomic update, especially when dealing with a page that may be in page_pool_unref_netmem()
261 * initially, and only overwrite it when the page is partitioned into in page_pool_unref_netmem()
290 static inline long page_pool_unref_page(struct page *page, long nr) in page_pool_unref_page() argument
292 return page_pool_unref_netmem(page_to_netmem(page), nr); in page_pool_unref_page()
300 static inline void page_pool_ref_page(struct page *page) in page_pool_ref_page() argument
302 page_pool_ref_netmem(page_to_netmem(page)); in page_pool_ref_page()
328 * page_pool_put_page() - release a reference to a page pool page
329 * @pool: pool from which page was allocated
330 * @page: page to release a reference on
331 * @dma_sync_size: how much of the page may have been touched by the device
334 * The outcome of this depends on the page refcnt. If the driver bumps
335 * the refcnt > 1 this will unmap the page. If the page refcnt is 1
336 * the allocator owns the page and will try to recycle it in one of the pool
337 * caches. If PP_FLAG_DMA_SYNC_DEV is set, the page will be synced for_device
341 struct page *page, in page_pool_put_page() argument
345 page_pool_put_netmem(pool, page_to_netmem(page), dma_sync_size, in page_pool_put_page()
357 * page_pool_put_full_page() - release a reference on a page pool page
358 * @pool: pool from which page was allocated
359 * @page: page to release a reference on
366 struct page *page, bool allow_direct) in page_pool_put_full_page() argument
368 page_pool_put_netmem(pool, page_to_netmem(page), -1, allow_direct); in page_pool_put_full_page()
372 * page_pool_recycle_direct() - release a reference on a page pool page
373 * @pool: pool from which page was allocated
374 * @page: page to release a reference on
377 * (e.g NAPI), since it will recycle the page directly into the pool fast cache.
380 struct page *page) in page_pool_recycle_direct() argument
382 page_pool_put_full_page(pool, page, true); in page_pool_recycle_direct()
414 * @page: page allocated from a page pool
416 * Fetch the DMA address of the page. The page pool to which the page belongs
419 static inline dma_addr_t page_pool_get_dma_addr(const struct page *page) in page_pool_get_dma_addr() argument
421 return page_pool_get_dma_addr_netmem(page_to_netmem((struct page *)page)); in page_pool_get_dma_addr()
425 * page_pool_dma_sync_for_cpu - sync Rx page for CPU after it's written by HW
426 * @pool: &page_pool the @page belongs to
427 * @page: page to sync
428 * @offset: offset from page start to "hard" start if using PP frags
429 * @dma_sync_size: size of the data written to the page
437 const struct page *page, in page_pool_dma_sync_for_cpu() argument
441 page_pool_get_dma_addr(page), in page_pool_dma_sync_for_cpu()