Commit e35ef639 authored by Anshuman Khandual's avatar Anshuman Khandual Committed by Linus Torvalds

mm/cma.c: warn if the CMA area could not be activated

While activating a CMA area we check to make sure that all the PFNs in
the range are inside the same zone.  This is a requirement for
alloc_contig_range() to work.  Any CMA area failing the check is
disabled for good.  This happens silently right now making all future
cma_alloc() allocations failure inevitable.

Here we add an error message stating that the CMA area could not be
activated which makes it easier to explain any future cma_alloc()
failures on it.  While in there, change the bail out goto label from
'err' to 'not_in_zone' which makes more sense.

Link: default avatarAnshuman Khandual <>
Cc: "Aneesh Kumar K.V" <>
Cc: Joonsoo Kim <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 78c72746
......@@ -127,7 +127,7 @@ static int __init cma_activate_area(struct cma *cma)
* to be in the same zone.
if (page_zone(pfn_to_page(pfn)) != zone)
goto err;
goto not_in_zone;
} while (--i);
......@@ -141,7 +141,8 @@ static int __init cma_activate_area(struct cma *cma)
return 0;
pr_err("CMA area %s could not be activated\n", cma->name);
cma->count = 0;
return -EINVAL;
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