From: Pavel Begunkov Date: Wed, 10 Mar 2021 13:13:55 +0000 (+0000) Subject: io_uring: simplify io_sqd_update_thread_idle() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c9dca27dc7f9c5dc4ee4ba5b77f7584387f867fe;p=linux.git io_uring: simplify io_sqd_update_thread_idle() Use a more comprehensible() max instead of hand coding it with ifs in io_sqd_update_thread_idle(). Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe --- diff --git a/fs/io_uring.c b/fs/io_uring.c index 094f869674b39..d5ef9560449b6 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6699,11 +6699,8 @@ static void io_sqd_update_thread_idle(struct io_sq_data *sqd) struct io_ring_ctx *ctx; unsigned sq_thread_idle = 0; - list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) { - if (sq_thread_idle < ctx->sq_thread_idle) - sq_thread_idle = ctx->sq_thread_idle; - } - + list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) + sq_thread_idle = max(sq_thread_idle, ctx->sq_thread_idle); sqd->sq_thread_idle = sq_thread_idle; }