[PATCH v3 1/3] mm/hugetlb: Allow arch to override and call the weak function
Liam R. Howlett
Liam.Howlett at Oracle.com
Fri Jul 28 01:25:56 AEST 2017
* Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com> [170727 02:18]:
> 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.
>
[...]
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index bc48ee783dd9..a3a7a7e6339e 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -2083,7 +2083,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;
> @@ -2104,6 +2106,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:
There is already a call to warn the user in the
hugetlb_hstate_alloc_pages function. If you look there, you will see
that the huge_page_size was translated into a more user friendly format
and the count prior to the failure is included. What call path are you
trying to cover? Also, you may want your print to be a pr_warn since it
is a failure?
Thanks,
Liam
More information about the Linuxppc-dev
mailing list