From: Pavel Begunkov <[email protected]>
To: Nathan Chancellor <[email protected]>
Cc: Jens Axboe <[email protected]>,
[email protected], [email protected]
Subject: Re: [PATCH 2/2] io_uring: optimise io_fail_links()
Date: Thu, 15 Oct 2020 11:11:52 +0100 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <20201015085319.GA3683749@ubuntu-m3-large-x86>
On 15/10/2020 09:53, Nathan Chancellor wrote:
> On Wed, Oct 14, 2020 at 08:44:22PM +0100, Pavel Begunkov wrote:
>> - io_put_req_deferred(link, 2);
>> +
>> + /*
>> + * It's ok to free under spinlock as they're not linked anymore,
>> + * but avoid REQ_F_WORK_INITIALIZED because it may deadlock on
>> + * work.fs->lock.
>> + */
>> + if (link->flags | REQ_F_WORK_INITIALIZED)
>> + io_put_req_deferred(link, 2);
>> + else
>> + io_double_put_req(link);
>
> fs/io_uring.c:1816:19: warning: bitwise or with non-zero value always
> evaluates to true [-Wtautological-bitwise-compare]
> if (link->flags | REQ_F_WORK_INITIALIZED)
> ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
> 1 warning generated.
>
> According to the comment, was it intended for that to be a bitwise AND
> then negated to check for the absence of it? If so, wouldn't it be
> clearer to flip the condition so that a negation is not necessary like
> below? I can send a formal patch if my analysis is correct but if not,
> feel free to fix it yourself and add
I have no idea what have happened, but yeah, there should be "&",
though without any additional negation. That's because deferred
version is safer.
Nathan, thanks for letting know!
Jens, could you please fold in the change below.
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 66c41d53a9d3..2c83c2688ec5 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1813,7 +1813,7 @@ static void __io_fail_links(struct io_kiocb *req)
* but avoid REQ_F_WORK_INITIALIZED because it may deadlock on
* work.fs->lock.
*/
- if (link->flags | REQ_F_WORK_INITIALIZED)
+ if (link->flags & REQ_F_WORK_INITIALIZED)
io_put_req_deferred(link, 2);
else
io_double_put_req(link);
--
Pavel Begunkov
next prev parent reply other threads:[~2020-10-15 10:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 19:44 [PATCH 0/2] post F_COMP_LOCKED optimisations Pavel Begunkov
2020-10-14 19:44 ` [PATCH 1/2] io_uring: optimise COMP_LOCK-less flush_completion Pavel Begunkov
2020-10-14 19:44 ` [PATCH 2/2] io_uring: optimise io_fail_links() Pavel Begunkov
2020-10-15 8:53 ` Nathan Chancellor
2020-10-15 10:11 ` Pavel Begunkov [this message]
2020-10-15 13:09 ` Jens Axboe
2020-10-14 19:53 ` [PATCH 0/2] post F_COMP_LOCKED optimisations Jens Axboe
2020-10-14 20:00 ` Pavel Begunkov
2020-10-14 20:24 ` 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 \
[email protected] \
[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