From: Yafang Shao <laoar.shao@gmail.com>
To: willy@infradead.org, akpm@linux-foundation.org, darrick.wong@oracle.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Yafang Shao <laoar.shao@gmail.com>
Subject: [PATCH] mm/filemap.c: minor optimization in write_iter file operation
Date: Sun, 18 Nov 2018 20:02:18 +0800 [thread overview]
Message-ID: <1542542538-11938-1-git-send-email-laoar.shao@gmail.com> (raw)
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@gmail.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
next reply other threads:[~2018-11-18 12:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-18 12:02 Yafang Shao [this message]
2018-11-18 12:13 ` [PATCH] mm/filemap.c: minor optimization in write_iter file operation Matthew Wilcox
2018-11-18 15:02 ` Yafang Shao
2018-11-19 1:03 ` Matthew Wilcox
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 \
--in-reply-to=1542542538-11938-1-git-send-email-laoar.shao@gmail.com \
--to=laoar.shao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=darrick.wong@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).