Commit 1c2308f0 authored by Jason Gunthorpe's avatar Jason Gunthorpe

mm/hmm.c: suppress compilation warnings when CONFIG_HUGETLB_PAGE is not set

gcc reports that several variables are defined but not used.

For the first hunk CONFIG_HUGETLB_PAGE the entire if block is already
protected by pud_huge() which is forced to 0.  None of the stuff under the
ifdef causes compilation problems as it is already stubbed out in the
header files.

For the second hunk the dummy huge_page_shift macro doesn't touch the
argument, so just inline the argument.

Link: http://lkml.kernel.org/r/20190522195151.GA23955@ziepe.caSigned-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent f2c7c76c
...@@ -788,7 +788,6 @@ static int hmm_vma_walk_pud(pud_t *pudp, ...@@ -788,7 +788,6 @@ static int hmm_vma_walk_pud(pud_t *pudp,
return hmm_vma_walk_hole_(addr, end, fault, return hmm_vma_walk_hole_(addr, end, fault,
write_fault, walk); write_fault, walk);
#ifdef CONFIG_HUGETLB_PAGE
pfn = pud_pfn(pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT); pfn = pud_pfn(pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
for (i = 0; i < npages; ++i, ++pfn) { for (i = 0; i < npages; ++i, ++pfn) {
hmm_vma_walk->pgmap = get_dev_pagemap(pfn, hmm_vma_walk->pgmap = get_dev_pagemap(pfn,
...@@ -804,9 +803,6 @@ static int hmm_vma_walk_pud(pud_t *pudp, ...@@ -804,9 +803,6 @@ static int hmm_vma_walk_pud(pud_t *pudp,
} }
hmm_vma_walk->last = end; hmm_vma_walk->last = end;
return 0; return 0;
#else
return -EINVAL;
#endif
} }
split_huge_pud(walk->vma, pudp, addr); split_huge_pud(walk->vma, pudp, addr);
...@@ -1015,9 +1011,8 @@ long hmm_range_snapshot(struct hmm_range *range) ...@@ -1015,9 +1011,8 @@ long hmm_range_snapshot(struct hmm_range *range)
return -EFAULT; return -EFAULT;
if (is_vm_hugetlb_page(vma)) { if (is_vm_hugetlb_page(vma)) {
struct hstate *h = hstate_vma(vma); if (huge_page_shift(hstate_vma(vma)) !=
range->page_shift &&
if (huge_page_shift(h) != range->page_shift &&
range->page_shift != PAGE_SHIFT) range->page_shift != PAGE_SHIFT)
return -EINVAL; return -EINVAL;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment