linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/hmm: move THP and hugetlbfs code path behind #if KCONFIG
@ 2019-04-22 16:37 jglisse
  0 siblings, 0 replies; only message in thread
From: jglisse @ 2019-04-22 16:37 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, Jérôme Glisse, Ralph Campbell,
	John Hubbard, Andrew Morton

From: Jérôme Glisse <jglisse@redhat.com>

To avoid any undefined symbol build warning or error, move THP and
hugetlbfs code behind kconfig #if/#else/#endif against appropriate
Kconfig option.

Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Cc: Ralph Campbell <rcampbell@nvidia.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 mm/hmm.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mm/hmm.c b/mm/hmm.c
index ecd16718285e..a8a950fe46b6 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -520,6 +520,7 @@ static int hmm_vma_handle_pmd(struct mm_walk *walk,
 			      uint64_t *pfns,
 			      pmd_t pmd)
 {
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
 	struct hmm_vma_walk *hmm_vma_walk = walk->private;
 	struct hmm_range *range = hmm_vma_walk->range;
 	unsigned long pfn, npages, i;
@@ -550,6 +551,10 @@ static int hmm_vma_handle_pmd(struct mm_walk *walk,
 	}
 	hmm_vma_walk->last = end;
 	return 0;
+#else
+	/* If THP is not enabled then we should never reach that code ! */
+	return -EINVAL;
+#endif
 }
 
 static inline uint64_t pte_to_hmm_pfn_flags(struct hmm_range *range, pte_t pte)
@@ -792,6 +797,7 @@ static int hmm_vma_walk_pud(pud_t *pudp,
 			return hmm_vma_walk_hole_(addr, end, fault,
 						write_fault, walk);
 
+#ifdef CONFIG_HUGETLB_PAGE
 		pfn = pud_pfn(pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
 		for (i = 0; i < npages; ++i, ++pfn) {
 			hmm_vma_walk->pgmap = get_dev_pagemap(pfn,
@@ -807,6 +813,9 @@ static int hmm_vma_walk_pud(pud_t *pudp,
 		}
 		hmm_vma_walk->last = end;
 		return 0;
+#else
+		return -EINVAL;
+#endif
 	}
 
 	split_huge_pud(walk->vma, pudp, addr);
-- 
2.20.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-22 16:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-22 16:37 [PATCH] mm/hmm: move THP and hugetlbfs code path behind #if KCONFIG jglisse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox