forked from mirrors/linux
		
	net: page_pool: add page allocation stats for two fast page allocate path
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: Jie Wang <wangjie125@huawei.com> Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									a19cef450b
								
							
						
					
					
						commit
						0f6deac3a0
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -704,9 +704,11 @@ struct page *page_pool_alloc_frag(struct page_pool *pool,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (page && *offset + size > max_size) {
 | 
						if (page && *offset + size > max_size) {
 | 
				
			||||||
		page = page_pool_drain_frag(pool, page);
 | 
							page = page_pool_drain_frag(pool, page);
 | 
				
			||||||
		if (page)
 | 
							if (page) {
 | 
				
			||||||
 | 
								alloc_stat_inc(pool, fast);
 | 
				
			||||||
			goto frag_reset;
 | 
								goto frag_reset;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!page) {
 | 
						if (!page) {
 | 
				
			||||||
		page = page_pool_alloc_pages(pool, gfp);
 | 
							page = page_pool_alloc_pages(pool, gfp);
 | 
				
			||||||
| 
						 | 
					@ -727,6 +729,7 @@ struct page *page_pool_alloc_frag(struct page_pool *pool,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pool->frag_users++;
 | 
						pool->frag_users++;
 | 
				
			||||||
	pool->frag_offset = *offset + size;
 | 
						pool->frag_offset = *offset + size;
 | 
				
			||||||
 | 
						alloc_stat_inc(pool, fast);
 | 
				
			||||||
	return page;
 | 
						return page;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL(page_pool_alloc_frag);
 | 
					EXPORT_SYMBOL(page_pool_alloc_frag);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue