[PATCH v2 1/2] mm/hugetlb: Allow arch to override and call the weak function
Aneesh Kumar K.V
aneesh.kumar at linux.vnet.ibm.com
Fri Jun 2 00:30:40 AEST 2017
For ppc64, we want to call this function when we are not running as guest.
Also, if we failed to allocate hugepages, let the user know.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>
---
include/linux/hugetlb.h | 1 +
mm/hugetlb.c | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index caee7c4664c8..964401ff0af0 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -357,6 +357,7 @@ int huge_add_to_page_cache(struct page *page, struct address_space *mapping,
pgoff_t idx);
/* arch callback */
+int __init __alloc_bootmem_huge_page(struct hstate *h);
int __init alloc_bootmem_huge_page(struct hstate *h);
void __init hugetlb_bad_size(void);
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 28217a147fe3..160282b13722 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2103,7 +2103,9 @@ struct page *alloc_huge_page_noerr(struct vm_area_struct *vma,
return page;
}
-int __weak alloc_bootmem_huge_page(struct hstate *h)
+int alloc_bootmem_huge_page(struct hstate *h)
+ __attribute__ ((weak, alias("__alloc_bootmem_huge_page")));
+int __alloc_bootmem_huge_page(struct hstate *h)
{
struct huge_bootmem_page *m;
int nr_nodes, node;
@@ -2124,6 +2126,7 @@ int __weak alloc_bootmem_huge_page(struct hstate *h)
goto found;
}
}
+ pr_info("Failed to allocate hugepage of size %ld\n", huge_page_size(h));
return 0;
found:
--
2.7.4
More information about the Linuxppc-dev
mailing list