Commit 243babb8 authored by Jie Wang's avatar Jie Wang Committed by Jiantao Xiao
Browse files

net: page_pool: add page allocation stats for two fast page allocate path

mainline inclusion
from mainline-v5.19-rc1
commit 0f6deac3
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8BNYE
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0f6deac3a07958195173119627502350925dce78



----------------------------------------------------------------------

Currently If use page pool allocation stats to analysis a RX performance
degradation problem. These stats only count for pages allocate from
page_pool_alloc_pages. But nic drivers such as hns3 use
page_pool_dev_alloc_frag to allocate pages, so page stats in this API
should also be counted.

Signed-off-by: default avatarJie Wang <wangjie125@huawei.com>
Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6eb24bf5
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -711,9 +711,11 @@ struct page *page_pool_alloc_frag(struct page_pool *pool,

	if (page && *offset + size > max_size) {
		page = page_pool_drain_frag(pool, page);
		if (page)
		if (page) {
			alloc_stat_inc(pool, fast);
			goto frag_reset;
		}
	}

	if (!page) {
		page = page_pool_alloc_pages(pool, gfp);
@@ -734,6 +736,7 @@ struct page *page_pool_alloc_frag(struct page_pool *pool,

	pool->frag_users++;
	pool->frag_offset = *offset + size;
	alloc_stat_inc(pool, fast);
	return page;
}
EXPORT_SYMBOL(page_pool_alloc_frag);