lkml.org 
[lkml]   [2021]   [Jan]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] fs/io_uring.c: remove unnecessary boolean instructions that add uops
Date
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 <goldstein.w.n@gmail.com>
---
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
\
 
 \ /
  Last update: 2021-01-02 22:07    [W:0.035 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site