diff mbox series

mm: cma: Use pr_err_ratelimited for CMA warning

Message ID ce2251ef49e1727a9a40531d1996660b05462bd2.1615279825.git.baolin.wang@linux.alibaba.com (mailing list archive)
State New, archived
Headers show
Series mm: cma: Use pr_err_ratelimited for CMA warning | expand

Commit Message

Baolin Wang March 9, 2021, 9:16 a.m. UTC
If we did not reserve extra CMA memory, the log buffer can be
easily filled up by CMA failure warning when the devices calling
dmam_alloc_coherent() to alloc DMA memory. Thus we can use
pr_err_ratelimited() instead to reduce the duplicate CMA warning.

Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
 mm/cma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Hildenbrand March 11, 2021, 4:53 p.m. UTC | #1
On 09.03.21 10:16, Baolin Wang wrote:
> If we did not reserve extra CMA memory, the log buffer can be
> easily filled up by CMA failure warning when the devices calling
> dmam_alloc_coherent() to alloc DMA memory. Thus we can use
> pr_err_ratelimited() instead to reduce the duplicate CMA warning.
> 
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> ---
>   mm/cma.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/cma.c b/mm/cma.c
> index 54eee21..d101bdb 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -500,8 +500,8 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
>   	}
>   
>   	if (ret && !no_warn) {
> -		pr_err("%s: %s: alloc failed, req-size: %zu pages, ret: %d\n",
> -		       __func__, cma->name, count, ret);
> +		pr_err_ratelimited("%s: %s: alloc failed, req-size: %zu pages, ret: %d\n",
> +				   __func__, cma->name, count, ret);
>   		cma_debug_show_areas(cma);
>   	}
>   
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
Minchan Kim March 11, 2021, 6:39 p.m. UTC | #2
On Tue, Mar 09, 2021 at 05:16:06PM +0800, Baolin Wang wrote:
> If we did not reserve extra CMA memory, the log buffer can be
> easily filled up by CMA failure warning when the devices calling
> dmam_alloc_coherent() to alloc DMA memory. Thus we can use
> pr_err_ratelimited() instead to reduce the duplicate CMA warning.
> 
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Acked-by: Minchan Kim <minchan@kernel.org>
diff mbox series

Patch

diff --git a/mm/cma.c b/mm/cma.c
index 54eee21..d101bdb 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -500,8 +500,8 @@  struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
 	}
 
 	if (ret && !no_warn) {
-		pr_err("%s: %s: alloc failed, req-size: %zu pages, ret: %d\n",
-		       __func__, cma->name, count, ret);
+		pr_err_ratelimited("%s: %s: alloc failed, req-size: %zu pages, ret: %d\n",
+				   __func__, cma->name, count, ret);
 		cma_debug_show_areas(cma);
 	}