From: Robin Murphy <robin.murphy@arm.com> To: linux-mm@kvack.org Cc: dan.j.williams@intel.com, ira.weiny@intel.com, jglisse@redhat.com, ohall@gmail.com, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, anshuman.khandual@arm.com, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] mm: clean up is_device_*_page() definitions Date: Fri, 12 Apr 2019 19:56:01 +0100 [thread overview] Message-ID: <2adb3982a790078fe49fd454414a7b9c0fd60bcb.1555093412.git.robin.murphy@arm.com> (raw) In-Reply-To: <cover.1555093412.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> 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 76769749b5a5..d76dfb7ac617 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -910,32 +910,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) { @@ -949,22 +923,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 */ static inline void get_page(struct page *page) { -- 2.21.0.dirty
WARNING: multiple messages have this Message-ID (diff)
From: Robin Murphy <robin.murphy@arm.com> To: linux-mm@kvack.org Cc: dan.j.williams@intel.com, ira.weiny@intel.com, jglisse@redhat.com, oohall@gmail.com, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, anshuman.khandual@arm.com, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 2/3] mm: clean up is_device_*_page() definitions Date: Fri, 12 Apr 2019 20:01:57 +0100 [thread overview] Message-ID: <2adb3982a790078fe49fd454414a7b9c0fd60bcb.1555093412.git.robin.murphy@arm.com> (raw) Message-ID: <20190412190157.O83IdKoXwnssSbzDlAeBQwzTZSSTT7p-ohrXscQ4-RI@z> (raw) In-Reply-To: <cover.1555093412.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> 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 76769749b5a5..d76dfb7ac617 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -910,32 +910,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) { @@ -949,22 +923,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 */ static inline void get_page(struct page *page) { -- 2.21.0.dirty
next prev parent reply other threads:[~2019-04-12 18:57 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-12 18:55 [PATCH 0/3] Device-memory-related cleanups Robin Murphy 2019-04-12 18:56 ` [PATCH 1/3] mm/memremap: Rename and consolidate SECTION_SIZE Robin Murphy 2019-04-12 19:01 ` [PATCH RESEND " Robin Murphy 2019-04-12 19:12 ` [PATCH " Dan Williams 2019-04-12 18:56 ` Robin Murphy [this message] 2019-04-12 19:01 ` [PATCH RESEND 2/3] mm: clean up is_device_*_page() definitions Robin Murphy 2019-04-15 11:25 ` Anshuman Khandual 2019-04-12 18:56 ` [PATCH 3/3] mm: introduce ARCH_HAS_PTE_DEVMAP Robin Murphy 2019-04-12 19:01 ` [PATCH RESEND " Robin Murphy 2019-04-12 19:37 ` Dan Williams 2019-04-12 20:09 ` [PATCH " Ira Weiny 2019-04-15 0:58 ` Oliver 2019-04-15 11:30 ` [PATCH RESEND " Anshuman Khandual 2019-04-12 19:01 ` [PATCH RESEND 0/3] Device-memory-related cleanups Robin Murphy
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=2adb3982a790078fe49fd454414a7b9c0fd60bcb.1555093412.git.robin.murphy@arm.com \ --to=robin.murphy@arm.com \ --cc=anshuman.khandual@arm.com \ --cc=dan.j.williams@intel.com \ --cc=ira.weiny@intel.com \ --cc=jglisse@redhat.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=ohall@gmail.com \ --cc=x86@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: linkBe 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).