public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: Xiaoguang Wang <[email protected]>,
	[email protected]
Cc: [email protected]
Subject: Re: [PATCH] io_uring: clear IORING_SQ_NEED_WAKEUP after executing task works
Date: Thu, 23 Jul 2020 10:03:56 -0600	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

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


      reply	other threads:[~2020-07-23 16:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 12:57 [PATCH] io_uring: clear IORING_SQ_NEED_WAKEUP after executing task works Xiaoguang Wang
2020-07-23 16:03 ` Jens Axboe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox