public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Ren Wei <n05ec@lzu.edu.cn>, io-uring@vger.kernel.org
Cc: axboe@kernel.dk, yifanwucs@gmail.com, tomapufckgml@gmail.com,
	yuantan098@gmail.com, bird@lzu.edu.cn, zcliangcn@gmail.com,
	ylong030@ucr.edu
Subject: Re: [PATCH 1/1] io_uring/poll: fix signed comparison in io_poll_get_ownership()
Date: Tue, 14 Apr 2026 11:50:29 +0100	[thread overview]
Message-ID: <703f88ff-5242-406c-87e2-8cf1a70bbf57@gmail.com> (raw)
In-Reply-To: <3a3508b08bcd7f1bc3beff848ae6e1d73d355043.1775965597.git.ylong030@ucr.edu>

On 4/12/26 09:38, Ren Wei wrote:
> From: Longxuan Yu <ylong030@ucr.edu>
> 
> io_poll_get_ownership() uses a signed comparison to check whether
> poll_refs has reached the threshold for the slowpath:
> 
>      if (unlikely(atomic_read(&req->poll_refs) >= IO_POLL_REF_BIAS))
> 
> atomic_read() returns int (signed). When IO_POLL_CANCEL_FLAG
> (BIT(31)) is set in poll_refs, the value becomes negative in
> signed arithmetic, so the >= 128 comparison always evaluates to
> false and the slowpath is never taken.
> 
> Fix this by casting the atomic_read() result to unsigned int
> before the comparison, so that the cancel flag is treated as a
> large positive value and correctly triggers the slowpath.

Looks good, thanks for the patch

Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>

-- 
Pavel Begunkov


  reply	other threads:[~2026-04-14 10:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1775965597.git.ylong030@ucr.edu>
2026-04-12  8:38 ` [PATCH 1/1] io_uring/poll: fix signed comparison in io_poll_get_ownership() Ren Wei
2026-04-14 10:50   ` Pavel Begunkov [this message]
2026-04-15 20:08   ` Jens Axboe
2026-04-15 20:09   ` Jens Axboe
2026-04-16  1:50     ` Yuan Tan
2026-04-16 15:28       ` Jens Axboe

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 \
    --in-reply-to=703f88ff-5242-406c-87e2-8cf1a70bbf57@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bird@lzu.edu.cn \
    --cc=io-uring@vger.kernel.org \
    --cc=n05ec@lzu.edu.cn \
    --cc=tomapufckgml@gmail.com \
    --cc=yifanwucs@gmail.com \
    --cc=ylong030@ucr.edu \
    --cc=yuantan098@gmail.com \
    --cc=zcliangcn@gmail.com \
    /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