lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1542542538-11938-1-git-send-email-laoar.shao@gmail.com>
Date:   Sun, 18 Nov 2018 20:02:18 +0800
From:   Yafang Shao <laoar.shao@...il.com>
To:     willy@...radead.org, akpm@...ux-foundation.org,
        darrick.wong@...cle.com
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Yafang Shao <laoar.shao@...il.com>
Subject: [PATCH] mm/filemap.c: minor optimization in write_iter file operation

This little adjustment on bitwise operation could make the code a little
faster.
As write_iter is used in lots of critical path, so this code change is
useful for performance.

Signed-off-by: Yafang Shao <laoar.shao@...il.com>
---
 mm/filemap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 81adec8..a65056ea 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2881,7 +2881,8 @@ inline ssize_t generic_write_checks(struct kiocb *iocb, struct iov_iter *from)
 	if (iocb->ki_flags & IOCB_APPEND)
 		iocb->ki_pos = i_size_read(inode);
 
-	if ((iocb->ki_flags & IOCB_NOWAIT) && !(iocb->ki_flags & IOCB_DIRECT))
+	if ((iocb->ki_flags & (IOCB_NOWAIT | IOCB_DIRECT)) ==
+	    IOCB_NOWAIT)
 		return -EINVAL;
 
 	count = iov_iter_count(from);
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ