From: Ben Luo <luoben@linux.alibaba.com>
To: alex.williamson@redhat.com, cohuck@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v2] vfio/type1: avoid redundant PageReserved checking
Date: Wed, 28 Aug 2019 12:28:04 +0800 [thread overview]
Message-ID: <3517844d6371794cff59b13bf9c2baf1dcbe571c.1566966365.git.luoben@linux.alibaba.com> (raw)
In-Reply-To: <20190827124041.4f986005@x1.home>
currently, if the page is not a tail of compound page, it will be
checked twice for the same thing.
Signed-off-by: Ben Luo <luoben@linux.alibaba.com>
---
drivers/vfio/vfio_iommu_type1.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 054391f..d0f7346 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -291,11 +291,10 @@ static int vfio_lock_acct(struct vfio_dma *dma, long npage, bool async)
static bool is_invalid_reserved_pfn(unsigned long pfn)
{
if (pfn_valid(pfn)) {
- bool reserved;
struct page *tail = pfn_to_page(pfn);
struct page *head = compound_head(tail);
- reserved = !!(PageReserved(head));
if (head != tail) {
+ bool reserved = PageReserved(head);
/*
* "head" is not a dangling pointer
* (compound_head takes care of that)
--
1.8.3.1
next prev parent reply other threads:[~2019-08-28 4:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-27 12:49 [PATCH] " Ben Luo
2019-08-27 18:40 ` Alex Williamson
2019-08-28 4:28 ` Ben Luo [this message]
2019-08-28 15:55 ` [PATCH v2] " Alex Williamson
2019-08-29 16:58 ` Ben Luo
2019-08-29 17:06 ` Alex Williamson
2019-09-02 7:58 ` Ben Luo
[not found] ` <5c9c57ba-ca5f-f080-3bb0-417a08788235@linux.alibaba.com>
2019-09-13 18:05 ` Alex Williamson
2019-09-30 23:35 ` Andrea Arcangeli
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=3517844d6371794cff59b13bf9c2baf1dcbe571c.1566966365.git.luoben@linux.alibaba.com \
--to=luoben@linux.alibaba.com \
--cc=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®