Message ID | 20241201010341.1382431-1-dafna.hirschfeld@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mm/hugetlb: change ENOSPC to ENOMEM in alloc_hugetlb_folio | expand |
On Sun, 1 Dec 2024 03:03:41 +0200 Dafna Hirschfeld <dafna.hirschfeld@intel.com> wrote: > The error ENOSPC is translated in vmf_error to VM_FAULT_SIGBUS which is > further translated in EFAULT in i.e. pin/get_user_pages. > But when running out of pages/hugepages we expect to see ENOMEM and > not EFAULT. > > ... > > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -3113,7 +3113,7 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, > if (!memcg_charge_ret) > mem_cgroup_cancel_charge(memcg, nr_pages); > mem_cgroup_put(memcg); > - return ERR_PTR(-ENOSPC); > + return ERR_PTR(-ENOMEM); > } > > int alloc_bootmem_huge_page(struct hstate *h, int nid) err, yes. ENOSPC is for disk drives! I'll slap a cc:stable on this fix for a decade old bug.
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index cec4b121193f..5c8de0f5c760 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3113,7 +3113,7 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, if (!memcg_charge_ret) mem_cgroup_cancel_charge(memcg, nr_pages); mem_cgroup_put(memcg); - return ERR_PTR(-ENOSPC); + return ERR_PTR(-ENOMEM); } int alloc_bootmem_huge_page(struct hstate *h, int nid)
The error ENOSPC is translated in vmf_error to VM_FAULT_SIGBUS which is further translated in EFAULT in i.e. pin/get_user_pages. But when running out of pages/hugepages we expect to see ENOMEM and not EFAULT. Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@intel.com> --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)