From: noah <[email protected]>
To: unlisted-recipients:; (no To-header on input)
Cc: [email protected], Jens Axboe <[email protected]>,
Alexander Viro <[email protected]>,
[email protected] (open list:IO_URING),
[email protected] (open list:FILESYSTEMS (VFS and
infrastructure)), [email protected] (open list)
Subject: [PATCH] fs/io_uring.c: remove unnecessary boolean instructions that add uops
Date: Sat, 2 Jan 2021 16:04:51 -0500 [thread overview]
Message-ID: <[email protected]> (raw)
This patch drops unnecessary comparisons to turn return values into
booleans. There is no reason to do a != for cancelled and posted as
they can be set to a boolean directly more efficiently.
Signed-off-by: noah <[email protected]>
---
fs/io_uring.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index ca46f314640b..6a46594e749a 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1607,11 +1607,11 @@ static bool io_kill_timeouts(struct io_ring_ctx *ctx, struct task_struct *tsk,
list_for_each_entry_safe(req, tmp, &ctx->timeout_list, timeout.list) {
if (io_match_task(req, tsk, files)) {
io_kill_timeout(req);
- canceled++;
+ canceled = 1;
}
}
spin_unlock_irq(&ctx->completion_lock);
- return canceled != 0;
+ return canceled;
}
static void __io_queue_deferred(struct io_ring_ctx *ctx)
@@ -5491,7 +5491,7 @@ static bool io_poll_remove_all(struct io_ring_ctx *ctx, struct task_struct *tsk,
list = &ctx->cancel_hash[i];
hlist_for_each_entry_safe(req, tmp, list, hash_node) {
if (io_match_task(req, tsk, files))
- posted += io_poll_remove_one(req);
+ posted |= io_poll_remove_one(req);
}
}
spin_unlock_irq(&ctx->completion_lock);
@@ -5499,7 +5499,7 @@ static bool io_poll_remove_all(struct io_ring_ctx *ctx, struct task_struct *tsk,
if (posted)
io_cqring_ev_posted(ctx);
- return posted != 0;
+ return posted;
}
static int io_poll_cancel(struct io_ring_ctx *ctx, __u64 sqe_addr)
--
2.29.2
reply other threads:[~2021-01-02 21:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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] \
[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