Skip to content

Commit c95257f

Browse files
isilenceaxboe
authored andcommitted
io_uring/zcrx: use guards for the refill lock
Use guards for rq_lock in io_zcrx_ring_refill(), makes it a tad simpler. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 73fa880 commit c95257f

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

io_uring/zcrx.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -756,14 +756,12 @@ static void io_zcrx_ring_refill(struct page_pool *pp,
756756
unsigned int mask = ifq->rq_entries - 1;
757757
unsigned int entries;
758758

759-
spin_lock_bh(&ifq->rq_lock);
759+
guard(spinlock_bh)(&ifq->rq_lock);
760760

761761
entries = io_zcrx_rqring_entries(ifq);
762762
entries = min_t(unsigned, entries, PP_ALLOC_CACHE_REFILL - pp->alloc.count);
763-
if (unlikely(!entries)) {
764-
spin_unlock_bh(&ifq->rq_lock);
763+
if (unlikely(!entries))
765764
return;
766-
}
767765

768766
do {
769767
struct io_uring_zcrx_rqe *rqe = io_zcrx_get_rqe(ifq, mask);
@@ -801,7 +799,6 @@ static void io_zcrx_ring_refill(struct page_pool *pp,
801799
} while (--entries);
802800

803801
smp_store_release(&ifq->rq_ring->head, ifq->cached_rq_head);
804-
spin_unlock_bh(&ifq->rq_lock);
805802
}
806803

807804
static void io_zcrx_refill_slow(struct page_pool *pp, struct io_zcrx_ifq *ifq)

0 commit comments

Comments
 (0)