diff options
author | Yunsheng Lin <linyunsheng@huawei.com> | 2024-02-28 12:30:10 +0300 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2024-03-05 13:38:14 +0300 |
commit | a0727489ac22d6fbd2e390d38a51193bba61da83 (patch) | |
tree | 51b3f63e7f2f7cab23e38206adac0ad945fcac70 /mm | |
parent | 4bc0d63a23957262b01b5848bd5e1739e98bbf36 (diff) | |
download | linux-a0727489ac22d6fbd2e390d38a51193bba61da83.tar.xz |
net: introduce page_frag_cache_drain()
When draining a page_frag_cache, most user are doing
the similar steps, so introduce an API to avoid code
duplication.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/page_alloc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 636145c29f70..06aa1ebbd21c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4699,6 +4699,16 @@ static struct page *__page_frag_cache_refill(struct page_frag_cache *nc, return page; } +void page_frag_cache_drain(struct page_frag_cache *nc) +{ + if (!nc->va) + return; + + __page_frag_cache_drain(virt_to_head_page(nc->va), nc->pagecnt_bias); + nc->va = NULL; +} +EXPORT_SYMBOL(page_frag_cache_drain); + void __page_frag_cache_drain(struct page *page, unsigned int count) { VM_BUG_ON_PAGE(page_ref_count(page) == 0, page); |