Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: page_pool: use in_softirq() instead

We use BH context only for synchronization, so we don't care if it's
actually serving softirq or not.

As a side node, in case of threaded NAPI, in_serving_softirq() will
return false because it's in process context with BH off, making
page_pool_recycle_in_cache() unreachable.

Signed-off-by: Qingfang DENG <qingfang.deng@siflower.com.cn>
Tested-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Qingfang DENG and committed by
David S. Miller
542bcea4 637bc8f0

+5 -5
+2 -2
include/net/page_pool.h
··· 386 386 static inline void page_pool_ring_lock(struct page_pool *pool) 387 387 __acquires(&pool->ring.producer_lock) 388 388 { 389 - if (in_serving_softirq()) 389 + if (in_softirq()) 390 390 spin_lock(&pool->ring.producer_lock); 391 391 else 392 392 spin_lock_bh(&pool->ring.producer_lock); ··· 395 395 static inline void page_pool_ring_unlock(struct page_pool *pool) 396 396 __releases(&pool->ring.producer_lock) 397 397 { 398 - if (in_serving_softirq()) 398 + if (in_softirq()) 399 399 spin_unlock(&pool->ring.producer_lock); 400 400 else 401 401 spin_unlock_bh(&pool->ring.producer_lock);
+3 -3
net/core/page_pool.c
··· 511 511 static bool page_pool_recycle_in_ring(struct page_pool *pool, struct page *page) 512 512 { 513 513 int ret; 514 - /* BH protection not needed if current is serving softirq */ 515 - if (in_serving_softirq()) 514 + /* BH protection not needed if current is softirq */ 515 + if (in_softirq()) 516 516 ret = ptr_ring_produce(&pool->ring, page); 517 517 else 518 518 ret = ptr_ring_produce_bh(&pool->ring, page); ··· 570 570 page_pool_dma_sync_for_device(pool, page, 571 571 dma_sync_size); 572 572 573 - if (allow_direct && in_serving_softirq() && 573 + if (allow_direct && in_softirq() && 574 574 page_pool_recycle_in_cache(page, pool)) 575 575 return NULL; 576 576