public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: ALOK TIWARI <alok.a.tiwari@oracle.com>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: axboe@kernel.dk, io-uring@vger.kernel.org
Subject: Re: [External] : Re: [PATCH] io_uring: fix incorrect unlikely() usage in io_waitid_prep()
Date: Sat, 18 Oct 2025 00:06:51 +0530	[thread overview]
Message-ID: <acdc65fc-372c-4bdc-a350-bd2dc75635e1@oracle.com> (raw)
In-Reply-To: <CADUfDZruQ7baruoBhSMBt6HcP-E-KiM1MHV=L9hn6OxFgEaXcw@mail.gmail.com>



On 10/17/2025 8:52 PM, Caleb Sander Mateos wrote:
> On Fri, Oct 17, 2025 at 5:41 AM Alok Tiwari<alok.a.tiwari@oracle.com> wrote:
>> The negation operator incorrectly places outside the unlikely() macro:
>>
>>      if (!unlikely(iwa))
>>
>> This caused the compiler hint to be applied to the constant result
>> of the negation rather than the pointer check itself.
> Not sure what you mean by "constant". But yes, applying !unlikely(iwa)
> inverts the hint, saying iwa is unlikely to be non-NULL and therefore
> the if branch is likely. It certainly seems more likely that the whole
> if condition was meant to me marked unlikely.
> 
> Best,
> Caleb
> 

Thanks Caleb.
you are right, "constant result" was a misleading choice of words.
I will update commit message and send a v2 patch.

>> Fix it by moving the negation inside unlikely(), matching the usual
>> kernel pattern:
>>
>>      if (unlikely(!iwa))
>>
>> Fixes: 2b4fc4cd43f2 ("io_uring/waitid: setup async data in the prep handler")
>> Signed-off-by: Alok Tiwari<alok.a.tiwari@oracle.com>
>> ---
>>   io_uring/waitid.c | 2 +-


Thanks,
Alok

      reply	other threads:[~2025-10-17 18:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17 12:41 [PATCH] io_uring: fix incorrect unlikely() usage in io_waitid_prep() Alok Tiwari
2025-10-17 15:22 ` Caleb Sander Mateos
2025-10-17 18:36   ` ALOK TIWARI [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 \
    --in-reply-to=acdc65fc-372c-4bdc-a350-bd2dc75635e1@oracle.com \
    --to=alok.a.tiwari@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=csander@purestorage.com \
    --cc=io-uring@vger.kernel.org \
    /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