From nobody Sat May 10 02:20:49 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1609621586; cv=none; d=zohomail.com; s=zohoarc; b=Fdo2FPsD/S0cIyQki0+U29/ErLBunmevYakg/feNKwEYDJ3cIdwrETvoNSR9QiuH/jqK0R8KZPyDNXcMTy2sy7TUGjbD7pywp6cavTJOLZbnHGXJ07xzBsJMmOQadog8VrgrJV0aUNKhoroON7WII1U/dwr9NMrgPbLalBRHOdM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609621586; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:MIME-Version:Message-ID:Subject:To; bh=U+9nqyimA47vW9KsG5PfL1LIdMRkpOZ4DJaxX52rJX4=; b=fCqmtw6gAKnwYKgSjHhzHU1RVMGy//xzLjebjf7g2CQoWg523JjQ0UJwhVm0vvFgFjdPafxK+7ARfy9EaDZKiN5WaFSTsu/LHz6mbBmE0ow8TMO596me1Epdce6vubmrJPk1kz+HxzkbjIzbeL06gzPeiz+LzRQnqDmHxijy4UI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1609621586153673.0958447986873; Sat, 2 Jan 2021 13:06:26 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726950AbhABVFu (ORCPT ); Sat, 2 Jan 2021 16:05:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726687AbhABVFt (ORCPT ); Sat, 2 Jan 2021 16:05:49 -0500 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7592C061573; Sat, 2 Jan 2021 13:05:08 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id p18so16249904pgm.11; Sat, 02 Jan 2021 13:05:08 -0800 (PST) Received: from noah.webpass.net (113.167.25.136.in-addr.arpa. [136.25.167.113]) by smtp.googlemail.com with ESMTPSA id il14sm16239330pjb.51.2021.01.02.13.05.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Jan 2021 13:05:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=U+9nqyimA47vW9KsG5PfL1LIdMRkpOZ4DJaxX52rJX4=; b=gSUB0YUnzW8Fcun1EKR9fsOlo4DIv1VNDEKGC2K0qWXCx3PSZjs+7IwGA7dVPB1ISp G4cdlkl8MkwiyQKKnB24DsLOZ9pHLdLYrShEeQ5zzRyXMh+/jchRqNqiQ0seD5ZHEhwJ aOhAYM8yLc1DF3wFGw1XMWvaxRf9fNF+e6Qq/94X1ESjdmw78/ySa3r6SK2nX4KHkOlg J58UTxcDtllhQug/uoftpJDMqFzjfBsQdqNgg/CY+kmO97FHz14bic4bZ+bJKoRHsYY1 MdsrD4Vs9x1hgAP4GgAfdPh9S5YCtup25sdeUveFr6O+mABhozXeVUgsZqEHC4zu4pbn zw/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=U+9nqyimA47vW9KsG5PfL1LIdMRkpOZ4DJaxX52rJX4=; b=UsdEnBCnM9AO1IKqKE+lA+PYdCX8DrkY3hN3EaNqp8Be0ma2BdI7AcFE9AFFSkvjg9 y/AhpnT0W0NFcew+yCU2yiY/izs35fRH+J5JKQyXCnN6L+bbsIKwGBfiF3mWOSMgnjKe 9CjetNNA/5XAjm9HY3Kz7+qxOyv2Q3PfTkMnTJJ2ARezbkU7FQAPCMV4NRWcFyabk+ig 8H9//XpOvw4uDPOBS9uv/lr5LYtN/g4oFcbkPAG9n1Sa4DVWs7xUqCGbt0a+2o47JHo0 YVRKQz732HobZtH592mQItkPbfoZnmMSuSfsIvMLk4bo90i/tAlIlRz7Do8mwdO/Gwle EJbQ== X-Gm-Message-State: AOAM531TpUlZAh5OGnMoUo61dlXZG8tZgpvnyl8N/O5UdzhmkOK4r2ZV Ax75XkHCMBkf3w9MvZgIMH8= X-Google-Smtp-Source: ABdhPJxz1ulLAO2NemL3/AKFUxrLpZSfqvofIvaC8qjRwzqJs6p67lmgSgSVXnjRdFcEyQ+vZvibnQ== X-Received: by 2002:a63:5f13:: with SMTP id t19mr66004315pgb.193.1609621508185; Sat, 02 Jan 2021 13:05:08 -0800 (PST) From: noah Cc: goldstein.w.n@gmail.com, Jens Axboe , Alexander Viro , io-uring@vger.kernel.org (open list:IO_URING), linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] fs/io_uring.c: remove unnecessary boolean instructions that add uops Date: Sat, 2 Jan 2021 16:04:51 -0500 Message-Id: <20210102210452.106399-1-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This patch drops unnecessary comparisons to turn return values into booleans. There is no reason to do a !=3D for cancelled and posted as they can be set to a boolean directly more efficiently. Signed-off-by: noah --- 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 *ct= x, 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 =3D 1; } } spin_unlock_irq(&ctx->completion_lock); - return canceled !=3D 0; + return canceled; } =20 static void __io_queue_deferred(struct io_ring_ctx *ctx) @@ -5491,7 +5491,7 @@ static bool io_poll_remove_all(struct io_ring_ctx *ct= x, struct task_struct *tsk, list =3D &ctx->cancel_hash[i]; hlist_for_each_entry_safe(req, tmp, list, hash_node) { if (io_match_task(req, tsk, files)) - posted +=3D io_poll_remove_one(req); + posted |=3D 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 *ct= x, struct task_struct *tsk, if (posted) io_cqring_ev_posted(ctx); =20 - return posted !=3D 0; + return posted; } =20 static int io_poll_cancel(struct io_ring_ctx *ctx, __u64 sqe_addr) --=20 2.29.2