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)
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.
107 * Return: allocated page fragment, otherwise return NULL.
109 static inline struct page *page_pool_dev_alloc_frag(struct page_pool *pool,
163 static inline struct page *page_pool_alloc(struct page_pool *pool,
171 * page_pool_dev_alloc() - allocate a page or a page fragment.
173 * @offset: offset to the allocated page
176 * Get a page or a page fragment from the page allocator or page_pool caches
180 * Return: allocated page or page fragment, otherwise return NULL.
182 static inline struct page *page_pool_dev_alloc(struct page_pool *pool,
195 struct page *page;
198 page = page_pool_alloc(pool, &offset, size, gfp & ~__GFP_HIGHMEM);
199 if (unlikely(!page))
202 return page_address(page) + offset;
206 * page_pool_dev_alloc_va() - allocate a page or a page fragment and return its
212 * it returns va of the allocated page or page fragment.
214 * Return: the va for the allocated page or page fragment, otherwise return NULL.
226 * @pool: pool from which page was allocated
243 * page_pool_fragment_page() - split a fresh page into fragments
244 * @page: page to split
247 * pp_ref_count represents the number of outstanding references to the page,
248 * which will be freed using page_pool APIs (rather than page allocator APIs
250 * objects like skbs marked for page pool recycling.
253 * freshly allocated page. The page must be freshly allocated (have a
260 static inline void page_pool_fragment_page(struct page *page, long nr)
262 page_pool_fragment_netmem(page_to_netmem(page), nr);
271 * references to the page:
278 * an atomic update, especially when dealing with a page that may be
281 * initially, and only overwrite it when the page is partitioned into
310 static inline long page_pool_unref_page(struct page *page, long nr)
312 return page_pool_unref_netmem(page_to_netmem(page), nr);
320 static inline void page_pool_ref_page(struct page *page)
322 page_pool_ref_netmem(page_to_netmem(page));
348 * page_pool_put_page() - release a reference to a page pool page
349 * @pool: pool from which page was allocated
350 * @page: page to release a reference on
351 * @dma_sync_size: how much of the page may have been touched by the device
354 * The outcome of this depends on the page refcnt. If the driver bumps
355 * the refcnt > 1 this will unmap the page. If the page refcnt is 1
356 * the allocator owns the page and will try to recycle it in one of the pool
357 * caches. If PP_FLAG_DMA_SYNC_DEV is set, the page will be synced for_device
361 struct page *page,
365 page_pool_put_netmem(pool, page_to_netmem(page), dma_sync_size,
377 * page_pool_put_full_page() - release a reference on a page pool page
378 * @pool: pool from which page was allocated
379 * @page: page to release a reference on
386 struct page *page, bool allow_direct)
388 page_pool_put_netmem(pool, page_to_netmem(page), -1, allow_direct);
392 * page_pool_recycle_direct() - release a reference on a page pool page
393 * @pool: pool from which page was allocated
394 * @page: page to release a reference on
397 * (e.g NAPI), since it will recycle the page directly into the pool fast cache.
400 struct page *page)
402 page_pool_put_full_page(pool, page, true);
440 * @page: page allocated from a page pool
442 * Fetch the DMA address of the page. The page pool to which the page belongs
445 static inline dma_addr_t page_pool_get_dma_addr(const struct page *page)
447 return page_pool_get_dma_addr_netmem(page_to_netmem(page));
460 * page_pool_dma_sync_for_cpu - sync Rx page for CPU after it's written by HW
461 * @pool: &page_pool the @page belongs to
462 * @page: page to sync
463 * @offset: offset from page start to "hard" start if using PP frags
464 * @dma_sync_size: size of the data written to the page
472 const struct page *page,
475 __page_pool_dma_sync_for_cpu(pool, page_pool_get_dma_addr(page), offset,
510 * @pool: queried page pool
512 * Check if page pool will return buffers which are unreadable to the CPU /
514 * which returns unreadable memory to the queue served by the page pool.
518 * Return: true if memory allocated by the page pool may be unreadable