From: Vlastimil Babka <vbabka@suse.cz>
To: Charan Teja Reddy <charante@codeaurora.org>,
akpm@linux-foundation.org, iamjoonsoo.kim@lge.com,
linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, vinmenon@codeaurora.org
Subject: Re: [PATCH] mm: cma: improve pr_debug log in cma_release()
Date: Fri, 27 Nov 2020 16:49:43 +0100 [thread overview]
Message-ID: <f6744947-72b5-39e0-9eb0-7f3f09f773b3@suse.cz> (raw)
In-Reply-To: <1606318341-29521-1-git-send-email-charante@codeaurora.org>
On 11/25/20 4:32 PM, Charan Teja Reddy wrote:
> 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.
>
> Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> mm/cma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/cma.c b/mm/cma.c
> index 7f415d7..07c904b 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -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);
>
>
prev parent reply other threads:[~2020-11-27 15:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 15:32 Charan Teja Reddy
2020-11-25 15:49 ` Souptick Joarder
2020-11-25 16:39 ` David Hildenbrand
2020-11-27 15:49 ` Vlastimil Babka [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f6744947-72b5-39e0-9eb0-7f3f09f773b3@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=charante@codeaurora.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vinmenon@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox