diff mbox series

[1/3] mm: Move lowmem_page_address() a little later

Message ID 20240404133642.971583-2-chenhuacai@loongson.cn (mailing list archive)
State New
Headers show
Series Make {virt, phys, page, pfn} translation work with KFENCE for LoongArch | expand

Commit Message

Huacai Chen April 4, 2024, 1:36 p.m. UTC
LoongArch will override page_to_virt() which use page_address() in the
KFENCE case (by defining WANT_PAGE_VIRTUAL/HASHED_PAGE_VIRTUAL). So move
lowmem_page_address() a little later to avoid such build errors:

error: implicit declaration of function 'page_address'.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 include/linux/mm.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Andrew Morton April 4, 2024, 6:25 p.m. UTC | #1
On Thu,  4 Apr 2024 21:36:34 +0800 Huacai Chen <chenhuacai@loongson.cn> wrote:

> LoongArch will override page_to_virt() which use page_address() in the
> KFENCE case (by defining WANT_PAGE_VIRTUAL/HASHED_PAGE_VIRTUAL). So move
> lowmem_page_address() a little later to avoid such build errors:
> 
> error: implicit declaration of function 'page_address'.
> 

Acked-by: Andrew Morton <akpm@linux-foundation.org>

Please ensure that it spends adequate time in linux-next for the
compilation testing.
Huacai Chen April 5, 2024, 9:21 a.m. UTC | #2
On Fri, Apr 5, 2024 at 2:25 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Thu,  4 Apr 2024 21:36:34 +0800 Huacai Chen <chenhuacai@loongson.cn> wrote:
>
> > LoongArch will override page_to_virt() which use page_address() in the
> > KFENCE case (by defining WANT_PAGE_VIRTUAL/HASHED_PAGE_VIRTUAL). So move
> > lowmem_page_address() a little later to avoid such build errors:
> >
> > error: implicit declaration of function 'page_address'.
> >
>
> Acked-by: Andrew Morton <akpm@linux-foundation.org>
>
> Please ensure that it spends adequate time in linux-next for the
> compilation testing.
OK, thanks.

Huacai
diff mbox series

Patch

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 0436b919f1c7..7b0ee64225de 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2207,11 +2207,6 @@  static inline int arch_make_folio_accessible(struct folio *folio)
  */
 #include <linux/vmstat.h>
 
-static __always_inline void *lowmem_page_address(const struct page *page)
-{
-	return page_to_virt(page);
-}
-
 #if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
 #define HASHED_PAGE_VIRTUAL
 #endif
@@ -2234,6 +2229,11 @@  void set_page_address(struct page *page, void *virtual);
 void page_address_init(void);
 #endif
 
+static __always_inline void *lowmem_page_address(const struct page *page)
+{
+	return page_to_virt(page);
+}
+
 #if !defined(HASHED_PAGE_VIRTUAL) && !defined(WANT_PAGE_VIRTUAL)
 #define page_address(page) lowmem_page_address(page)
 #define set_page_address(page, address)  do { } while(0)