LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: linux-mm@kvack.org
Cc: akpm@linux-foundation.org, will.deacon@arm.com,
catalin.marinas@arm.com, anshuman.khandual@arm.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Jerome Glisse <jglisse@redhat.com>
Subject: [PATCH v3 2/4] mm: clean up is_device_*_page() definitions
Date: Thu, 23 May 2019 16:03:14 +0100 [thread overview]
Message-ID: <187c2ab27dea70635d375a61b2f2076d26c032b0.1558547956.git.robin.murphy@arm.com> (raw)
In-Reply-To: <cover.1558547956.git.robin.murphy@arm.com>
Refactor is_device_{public,private}_page() with is_pci_p2pdma_page()
to make them all consistent in depending on their respective config
options even when CONFIG_DEV_PAGEMAP_OPS is enabled for other reasons.
This allows a little more compile-time optimisation as well as the
conceptual and cosmetic cleanup.
Suggested-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
include/linux/mm.h | 43 +++++++++++++------------------------------
1 file changed, 13 insertions(+), 30 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 0e8834ac32b7..9cd613a7f67b 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -942,32 +942,6 @@ static inline bool put_devmap_managed_page(struct page *page)
}
return false;
}
-
-static inline bool is_device_private_page(const struct page *page)
-{
- return is_zone_device_page(page) &&
- page->pgmap->type == MEMORY_DEVICE_PRIVATE;
-}
-
-static inline bool is_device_public_page(const struct page *page)
-{
- return is_zone_device_page(page) &&
- page->pgmap->type == MEMORY_DEVICE_PUBLIC;
-}
-
-#ifdef CONFIG_PCI_P2PDMA
-static inline bool is_pci_p2pdma_page(const struct page *page)
-{
- return is_zone_device_page(page) &&
- page->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA;
-}
-#else /* CONFIG_PCI_P2PDMA */
-static inline bool is_pci_p2pdma_page(const struct page *page)
-{
- return false;
-}
-#endif /* CONFIG_PCI_P2PDMA */
-
#else /* CONFIG_DEV_PAGEMAP_OPS */
static inline void dev_pagemap_get_ops(void)
{
@@ -981,22 +955,31 @@ static inline bool put_devmap_managed_page(struct page *page)
{
return false;
}
+#endif /* CONFIG_DEV_PAGEMAP_OPS */
static inline bool is_device_private_page(const struct page *page)
{
- return false;
+ return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) &&
+ IS_ENABLED(CONFIG_DEVICE_PRIVATE) &&
+ is_zone_device_page(page) &&
+ page->pgmap->type == MEMORY_DEVICE_PRIVATE;
}
static inline bool is_device_public_page(const struct page *page)
{
- return false;
+ return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) &&
+ IS_ENABLED(CONFIG_DEVICE_PUBLIC) &&
+ is_zone_device_page(page) &&
+ page->pgmap->type == MEMORY_DEVICE_PUBLIC;
}
static inline bool is_pci_p2pdma_page(const struct page *page)
{
- return false;
+ return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) &&
+ IS_ENABLED(CONFIG_PCI_P2PDMA) &&
+ is_zone_device_page(page) &&
+ page->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA;
}
-#endif /* CONFIG_DEV_PAGEMAP_OPS */
/* 127: arbitrary random number, small enough to assemble well */
#define page_ref_zero_or_close_to_overflow(page) \
--
2.21.0.dirty
next prev parent reply other threads:[~2019-05-23 15:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 15:03 [PATCH v3 0/4] Devmap cleanups + arm64 support Robin Murphy
2019-05-23 15:03 ` [PATCH v3 1/4] mm/memremap: Rename and consolidate SECTION_SIZE Robin Murphy
2019-05-23 15:03 ` Robin Murphy [this message]
2019-05-23 15:03 ` [PATCH v3 3/4] mm: introduce ARCH_HAS_PTE_DEVMAP Robin Murphy
2019-05-23 15:03 ` [PATCH v3 4/4] arm64: mm: Implement pte_devmap support Robin Murphy
2019-05-24 18:08 ` Will Deacon
2019-05-24 18:38 ` Robin Murphy
2019-05-27 6:23 ` Anshuman Khandual
2019-05-28 13:46 ` [PATCH v3.1 " Robin Murphy
2019-05-29 10:03 ` Will Deacon
2019-06-26 7:35 ` [PATCH v3 0/4] Devmap cleanups + arm64 support Christoph Hellwig
2019-06-26 12:31 ` Mark Rutland
2019-06-26 15:38 ` Christoph Hellwig
2019-06-26 15:45 ` Jason Gunthorpe
2019-06-27 3:35 ` Andrew Morton
2019-07-04 18:53 ` Andrew Morton
2019-07-04 19:59 ` Jason Gunthorpe
2019-07-04 20:53 ` Andrew Morton
2019-07-04 21:28 ` Jason Gunthorpe
2019-07-05 15:47 ` Jason Gunthorpe
2019-07-04 20:54 ` Robin Murphy
2019-07-04 21:13 ` Andrew Morton
2019-07-05 11:16 ` Robin Murphy
2019-07-04 23:37 ` Dan Williams
2019-07-05 12:32 ` Jason Gunthorpe
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=187c2ab27dea70635d375a61b2f2076d26c032b0.1558547956.git.robin.murphy@arm.com \
--to=robin.murphy@arm.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=catalin.marinas@arm.com \
--cc=jglisse@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=will.deacon@arm.com \
--subject='Re: [PATCH v3 2/4] mm: clean up is_device_*_page() definitions' \
/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
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).