Re: [PATCH] io_uring: clear IORING_SQ_NEED_WAKEUP after executing task works

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/23/20 6:57 AM, Xiaoguang Wang wrote:
> In io_sq_thread(), if there are task works to handle, current codes
> will skip schedule() and go on polling sq again, but forget to clear
> IORING_SQ_NEED_WAKEUP flag, fix this issue. Also add two helpers to
> set and clear IORING_SQ_NEED_WAKEUP flag,

Was pondering if we should make the new helpers conditional ala:

static inline void io_ring_set_wakeup_flag(struct io_ring_ctx *ctx)
{
	/* Tell userspace we may need a wakeup call */
	if (!(ctx->rings->sq_flags & IORING_SQ_NEED_WAKEUP)) {
		spin_lock_irq(&ctx->completion_lock);
		ctx->rings->sq_flags |= IORING_SQ_NEED_WAKEUP;
		spin_unlock_irq(&ctx->completion_lock);
	}
}

static inline void io_ring_clear_wakeup_flag(struct io_ring_ctx *ctx)
{
	if (ctx->rings->sq_flags & IORING_SQ_NEED_WAKEUP) {
		spin_lock_irq(&ctx->completion_lock);
		ctx->rings->sq_flags &= ~IORING_SQ_NEED_WAKEUP;
		spin_unlock_irq(&ctx->completion_lock);
	}
}

but don't see any need after looking closer. So patch looks fine to me,
thanks.

-- 
Jens Axboe




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux