Skip to contentSkip to conversation

mm, hugetlbfs: include mm.h for vm_operations_struct

PATCH In review Arnd Bergmann 4 participants 6 messages Dec 11, 2017 – Dec 13, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm, hugetlbfs: include mm.h for vm_operations_struct

The infiniband umem code causes a build failure in some configurations:

In file included from drivers/infiniband/core/umem_odp.c:41:0:
include/linux/hugetlb.h: In function 'vma_kernel_pagesize':
include/linux/hugetlb.h:262:32: error: dereferencing pointer to incomplete type 'const struct vm_operations_struct'

Including the header file that defines the structure is sufficient to avoid this.

Fixes ac9284a6b670 ("mm, hugetlbfs: introduce ->pagesize() to vm_operations_struct")
---
 include/linux/hugetlb.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/hugetlb.h +1 -0
index b0f1f6768336..082ff47201be 100644
@@ -9,6 +9,7 @@
 #include <linux/cgroup.h>
 #include <linux/list.h>
 #include <linux/kref.h>
+#include <linux/mm.h>
 #include <asm/pgtable.h>
 
 struct ctl_table;
Signature · 1 line
2.9.0
#1 lore raw

Hi Arnd,

Quoted 7 lines · On Mon, 11 Dec 2017 17:21:27 +0100 Arnd Bergmann <[email protected]> wrote:

The infiniband umem code causes a build failure in some configurations:

In file included from drivers/infiniband/core/umem_odp.c:41:0:
include/linux/hugetlb.h: In function 'vma_kernel_pagesize':
include/linux/hugetlb.h:262:32: error: dereferencing pointer to incomplete type 'const struct vm_operations_struct'

Quoted 5 lines

Including the header file that defines the structure is sufficient to avoid this.

Fixes ac9284a6b670 ("mm, hugetlbfs: introduce ->pagesize() to vm_operations_struct")

Added to linux-next today.

Signature · 2 lines
Cheers,
Stephen Rothwell
#2 lore raw
In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann

The infiniband umem code causes a build failure in some configurations:

In file included from drivers/infiniband/core/umem_odp.c:41:0:
include/linux/hugetlb.h: In function 'vma_kernel_pagesize':
include/linux/hugetlb.h:262:32: error: dereferencing pointer to incomplete type 'const struct vm_operations_struct'

Including the header file that defines the structure is sufficient to avoid this.

Fixes ac9284a6b670 ("mm, hugetlbfs: introduce ->pagesize() to vm_operations_struct")

I've tried to do the same but the compilation failed for other arches/configs. See http://lkml.kernel.org/r/[email protected]

Quoted 19 lines
---
 include/linux/hugetlb.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/hugetlb.h +1 -0
index b0f1f6768336..082ff47201be 100644
@@ -9,6 +9,7 @@
 #include <linux/cgroup.h>
 #include <linux/list.h>
 #include <linux/kref.h>
+#include <linux/mm.h>
 #include <asm/pgtable.h>
 
 struct ctl_table;
Signature · 1 line
2.9.0
Signature · 2 lines
Michal Hocko
SUSE Labs
#3 lore raw
Quoted 7 lines · Michal Hocko
Quoted 6 lines · Arnd Bergmann

The infiniband umem code causes a build failure in some configurations:

In file included from drivers/infiniband/core/umem_odp.c:41:0:
include/linux/hugetlb.h: In function 'vma_kernel_pagesize':
include/linux/hugetlb.h:262:32: error: dereferencing pointer to incomplete type 'const struct vm_operations_struct'

Quoted 8 lines
Quoted 5 lines

Including the header file that defines the structure is sufficient to avoid this.

Fixes ac9284a6b670 ("mm, hugetlbfs: introduce ->pagesize() to vm_operations_struct")

I've tried to do the same but the compilation failed for other arches/configs. See http://lkml.kernel.org/r/[email protected]

Andrew, Stephen, please drop this ->pagesize() patch out of -mm and -next. I'll circle back once I have this include dependency fixed up. Thanks for the reports and sorry for the noise.

#4 lore raw

Hi Dan,

Quoted 15 lines · On Tue, 12 Dec 2017 00:05:08 -0800 Dan Williams <[email protected]>…
Quoted 13 lines · Michal Hocko
Quoted 11 lines · Arnd Bergmann

The infiniband umem code causes a build failure in some configurations:

In file included from drivers/infiniband/core/umem_odp.c:41:0:
include/linux/hugetlb.h: In function 'vma_kernel_pagesize':
include/linux/hugetlb.h:262:32: error: dereferencing pointer to incomplete type 'const struct vm_operations_struct'

Including the header file that defines the structure is sufficient to avoid this.

Fixes ac9284a6b670 ("mm, hugetlbfs: introduce ->pagesize() to vm_operations_struct")
Quoted 6 lines
Quoted 2 lines

I've tried to do the same but the compilation failed for other arches/configs. See http://lkml.kernel.org/r/[email protected]

Andrew, Stephen, please drop this ->pagesize() patch out of -mm and -next. I'll circle back once I have this include dependency fixed up. Thanks for the reports and sorry for the noise.

I have removed commits:

ac9284a6b670 ("mm, hugetlbfs: introduce ->pagesize() to vm_operations_struct") d8115c6f55a0 ("device-dax: implement ->pagesize() for smaps to report MMUPageSize")

from my copy of the mmotm tree from today.

Signature · 2 lines
Cheers,
Stephen Rothwell
#5 lore raw
In reply to Michal Hocko

Hi Michal,

Quoted 8 lines · On Tue, 12 Dec 2017 08:47:22 +0100 Michal Hocko <[email protected]> wrote:
Quoted 6 lines · Arnd Bergmann

The infiniband umem code causes a build failure in some configurations:

In file included from drivers/infiniband/core/umem_odp.c:41:0:
include/linux/hugetlb.h: In function 'vma_kernel_pagesize':
include/linux/hugetlb.h:262:32: error: dereferencing pointer to incomplete type 'const struct vm_operations_struct'

Quoted 8 lines
Quoted 5 lines

Including the header file that defines the structure is sufficient to avoid this.

Fixes ac9284a6b670 ("mm, hugetlbfs: introduce ->pagesize() to vm_operations_struct")

I've tried to do the same but the compilation failed for other arches/configs. See http://lkml.kernel.org/r/[email protected]

I sent a patch yesterday for that particular powerpc failure ... You were not CC'd, but I have attached the email.

Signature · 2 lines
Cheers,
Stephen Rothwell

Hi Andrew,

After merging the akpm-current tree, today's linux-next build (powerpc ppc64_defconfig) failed like this:

In file included from include/linux/hugetlb.h:451:0,
from arch/powerpc/mm/hugetlbpage.c:14:
arch/powerpc/include/asm/hugetlb.h:125:26: error: redefinition of 'vma_mmu_pagesize'

 #define vma_mmu_pagesize vma_mmu_pagesize
                          ^
arch/powerpc/mm/hugetlbpage.c:563:15: note: in expansion of macro 'vma_mmu_pagesize'
 unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
               ^
In file included from arch/powerpc/mm/hugetlbpage.c:14:0:
include/linux/hugetlb.h:274:29: note: previous definition of 'vma_mmu_pagesize' was here
 static inline unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
                             ^

Caused by commit

ac9284a6b670 ("mm, hugetlbfs: introduce ->pagesize() to vm_operations_struct")

I have added the following fix patch for today:

From: Stephen Rothwell <[email protected]>
Date: Mon, 11 Dec 2017 15:51:41 +1100
Subject: [PATCH] mm, hugetlbfs: move testing of vma_mmu_pagesize to after
inclusion of asm/hugetlb.h

---
 arch/powerpc/include/asm/hugetlb.h |  1 +
 include/linux/hugetlb.h            | 26 +++++++++++++-------------
 2 files changed, 14 insertions(+), 13 deletions(-)
arch/powerpc/include/asm/hugetlb.h +1 -0
index 14c9d44f355b..3cc6ca1bdaf2 100644
@@ -123,6 +123,7 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
  * to override the version in mm/hugetlb.c
  */
 #define vma_mmu_pagesize vma_mmu_pagesize
+unsigned long vma_mmu_pagesize(struct vm_area_struct *vma);
 
 /*
  * If the arch doesn't supply something else, assume that hugepage
include/linux/hugetlb.h +13 -13
index c354befab724..b0f1f6768336 100644
@@ -264,19 +264,6 @@ static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
 	return PAGE_SIZE;
 }
 
-/*
- * Return the page size being used by the MMU to back a VMA. In the majority
- * of cases, the page size used by the kernel matches the MMU size. On
- * architectures where it differs, an architecture-specific version of this
- * function is required.
- */
-#ifndef vma_mmu_pagesize
-static inline unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
-{
-	return vma_kernel_pagesize(vma);
-}
-#endif
-
 #ifdef CONFIG_HUGETLBFS
 struct hugetlbfs_sb_info {
 	long	max_inodes;   /* inodes allowed */
@@ -615,6 +602,19 @@ static inline void set_huge_swap_pte_at(struct mm_struct *mm, unsigned long addr
 }
 #endif	/* CONFIG_HUGETLB_PAGE */
 
+/*
+ * Return the page size being used by the MMU to back a VMA. In the majority
+ * of cases, the page size used by the kernel matches the MMU size. On
+ * architectures where it differs, an architecture-specific version of this
+ * function is required.
+ */
+#ifndef vma_mmu_pagesize
+static inline unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
+{
+	return vma_kernel_pagesize(vma);
+}
+#endif
+
 static inline spinlock_t *huge_pte_lock(struct hstate *h,
 					struct mm_struct *mm, pte_t *pte)
 {
Signature · 5 lines
2.15.0

-- 
Cheers,
Stephen Rothwell