mm: cma: improve pr_debug log in cma_release()
Subsystems (2)
PATCH 1/1 mm: cma: improve pr_debug log in cma_release()
It is required to print 'count' of pages, along with the pages, passed to cma_release to debug the cases of mismatched count value passed between cma_alloc() and cma_release() from a code path.
As an example, consider the below scenario:
1) CMA pool size is 4MB and
2) User doing the erroneous step of allocating 2 pages but freeing 1 page in a loop from this CMA pool.
The step 2 causes cma_alloc() to return NULL at one point of time because of -ENOMEM condition.
And the current pr_debug logs is not giving the info about these types of allocation patterns because of count value not being printed in cma_release().
We are printing the count value in the trace logs, just extend the same to pr_debug logs too.
--- mm/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/cma.c +1 -1
@@ -512,7 +512,7 @@ bool cma_release(struct cma *cma, const struct page *pages, unsigned int count)if (!cma || !pages)return false; -pr_debug ("%s(page %p)\n" , __func__, (void *)pages); +pr_debug ("%s(page %p, count %zu)\n" , __func__, (void *)pages, count); pfn =page_to_pfn (pages);
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Quoted 12 lines · Charan Teja Reddy
It is required to print 'count' of pages, along with the pages, passed to
cma_releaseto debug the cases of mismatched count value passed betweencma_alloc()andcma_release()from a code path.As an example, consider the below scenario:
1) CMA pool size is 4MB and
2) User doing the erroneous step of allocating 2 pages but freeing 1 page in a loop from this CMA pool.
The step 2 causescma_alloc()to return NULL at one point of time because of-ENOMEMcondition.
Quoted 8 lines
And the current
pr_debuglogs is not giving the info about these types of allocation patterns because of count value not being printed incma_release().We are printing the count value in the trace logs, just extend the same to
pr_debuglogs too.Signed-off-by Charan Teja Reddy <[email protected]>
Quoted 22 lines
--- mm/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/cma.c +1
-2@@ -512,7 +512,7 @@ bool cma_release(struct cma *cma, const struct page *pages, unsigned int count)if (!cma || !pages)return false; -pr_debug ("%s(page %p)\n" , __func__, (void *)pages); +pr_debug ("%s(page %p, count %zu)\n" , __func__, (void *)pages, count); pfn =page_to_pfn (pages); --QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Quoted 29 lines · Charan Teja Reddy
It is required to print 'count' of pages, along with the pages, passed to
cma_releaseto debug the cases of mismatched count value passed betweencma_alloc()andcma_release()from a code path.As an example, consider the below scenario:
1) CMA pool size is 4MB and
2) User doing the erroneous step of allocating 2 pages but freeing 1 page in a loop from this CMA pool.
The step 2 causescma_alloc()to return NULL at one point of time because of-ENOMEMcondition.And the current
pr_debuglogs is not giving the info about these types of allocation patterns because of count value not being printed incma_release().We are printing the count value in the trace logs, just extend the same to
pr_debuglogs too.Signed-off-by Charan Teja Reddy <[email protected]>--- mm/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/cma.c +0
-0
mm/cma.c bool cma_release(struct cma *cma, const struct page *pages, unsigned int count) · line 518
Quoted 8 lines
mm/cma.c +1
-1@@ -512,7 +512,7 @@ bool cma_release(struct cma *cma, const struct page *pages, unsigned int count)if (!cma || !pages)return false; -pr_debug ("%s(page %p)\n" , __func__, (void *)pages); +pr_debug ("%s(page %p, count %zu)\n" , __func__, (void *)pages, count); pfn =page_to_pfn (pages);
Signature · 3 lines
Thanks, David / dhildenb
Quoted 11 lines · Charan Teja Reddy
It is required to print 'count' of pages, along with the pages, passed to
cma_releaseto debug the cases of mismatched count value passed betweencma_alloc()andcma_release()from a code path.As an example, consider the below scenario:
1) CMA pool size is 4MB and
2) User doing the erroneous step of allocating 2 pages but freeing 1 page in a loop from this CMA pool.
The step 2 causescma_alloc()to return NULL at one point of time because of-ENOMEMcondition.
Quoted 8 lines
And the current
pr_debuglogs is not giving the info about these types of allocation patterns because of count value not being printed incma_release().We are printing the count value in the trace logs, just extend the same to
pr_debuglogs too.Signed-off-by Charan Teja Reddy <[email protected]>
Quoted 18 lines
--- mm/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/cma.c +1
-1@@ -512,7 +512,7 @@ bool cma_release(struct cma *cma, const struct page *pages, unsigned int count)if (!cma || !pages)return false; -pr_debug ("%s(page %p)\n" , __func__, (void *)pages); +pr_debug ("%s(page %p, count %zu)\n" , __func__, (void *)pages, count); pfn =page_to_pfn (pages);