[PATCH] mmotm: hugetlbfs-new-huge_add_to_page_cache-helper-routine-fix

From: Michal Hocko
Date: Fri Jul 24 2015 - 02:14:32 EST


hugetlbfs_fallocate relies on CONFIG_NUMA and fails to compile otherwise.
This just makes the code compile but it seems it begs for a better solution.

fs/hugetlbfs/inode.c: In function âhugetlbfs_fallocateâ:
fs/hugetlbfs/inode.c:578:13: error: âstruct vm_area_structâ has no member named âvm_policyâ
pseudo_vma.vm_policy =
^
fs/hugetlbfs/inode.c:579:4: error: implicit declaration of function âmpol_shared_policy_lookupâ [-Werror=implicit-function-declaration]
mpol_shared_policy_lookup(&HUGETLBFS_I(inode)->policy,
^
fs/hugetlbfs/inode.c:595:28: error: âstruct vm_area_structâ has no member named âvm_policyâ
mpol_cond_put(pseudo_vma.vm_policy);
^
fs/hugetlbfs/inode.c:601:27: error: âstruct vm_area_structâ has no member named âvm_policyâ
mpol_cond_put(pseudo_vma.vm_policy);

Signed-off-by: Michal Hocko <mhocko@xxxxxxxx>
---
fs/hugetlbfs/inode.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index d977cae89d29..dfca09218d77 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -575,9 +575,11 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
}

/* Get policy based on index */
+#ifdef CONFIG_NUMA
pseudo_vma.vm_policy =
mpol_shared_policy_lookup(&HUGETLBFS_I(inode)->policy,
index);
+#endif

/* addr is the offset within the file (zero based) */
addr = index * hpage_size;
@@ -592,13 +594,17 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
if (page) {
put_page(page);
mutex_unlock(&hugetlb_fault_mutex_table[hash]);
+#ifdef CONFIG_NUMA
mpol_cond_put(pseudo_vma.vm_policy);
+#endif
continue;
}

/* Allocate page and add to page cache */
page = alloc_huge_page(&pseudo_vma, addr, avoid_reserve);
+#ifdef CONFIG_NUMA
mpol_cond_put(pseudo_vma.vm_policy);
+#endif
if (IS_ERR(page)) {
mutex_unlock(&hugetlb_fault_mutex_table[hash]);
error = PTR_ERR(page);
--
2.1.4


--
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/