linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Faiyaz Mohammed <faiyazm@codeaurora.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	vinmenon@codeaurora.org
Subject: Re: [PATCH] mm: memblock: add more debug logs
Date: Wed, 11 Nov 2020 14:28:43 +0200	[thread overview]
Message-ID: <20201111122843.GH4758@kernel.org> (raw)
In-Reply-To: <f1e3c3c8-ed4f-9283-e221-7faec10fdd8d@codeaurora.org>

On Wed, Nov 11, 2020 at 01:30:40PM +0530, Faiyaz Mohammed wrote:
> 
> On 11/10/2020 11:46 PM, Mike Rapoport wrote:
> > Hi,
> > 
> > On Tue, Nov 10, 2020 at 05:49:58PM +0530, Faiyaz Mohammed wrote:
> > > Exact caller of memblock_phys_alloc_range is not available with
> > > "memblock=debug". Below information is not enough for memory accounting.
> > > for example:
> > > [    0.000000] memblock_reserve: [0x000000023fc6b000-0x000000023fc6bfff] memblock_alloc_range_nid+0xc0/0x188
> > > 
> > > To enhance the memblock_dbg information or to get the exact owner of the
> > > memblock_reserve, add debug logs in memblock_phys_alloc_range function.
> > Why would you want to use memblock=debug for memory accounting or for
> > tracking of the owners of the reserved memory?

> We do memblock reserved accounting to track owners to know size of memory
> allocated by different drivers/owners through memblock_reserve, which help
> in comparing different kernel version and in optimizations.

I'd suggest to update the commit messaget to somthing like:

It is usefull to know the exact caller of memblock_phys_alloc_range() to
track early memory reservations during developement. 

Currently, when memblock debugging is enabled, the allocations done with
memblock_phys_alloc_range() are only reported at memblock_reserve():

[    0.000000] memblock_reserve: [0x000000023fc6b000-0x000000023fc6bfff] memblock_alloc_range_nid+0xc0/0x188

Add memblock_dbg() to memblock_phys_alloc_range() to get details about
its usage.

For example:

[    0.000000] memblock_phys_alloc_range: 4096 bytes align=0x1000 from=0x0000000000000000 max_addr=0x0000000000000000 early_pgtable_alloc+0x24/0x178
[    0.000000] memblock_reserve: [0x000000023fc6b000-0x000000023fc6bfff] memblock_alloc_range_nid+0xc0/0x188

> > > After adding logs:
> > > [    0.000000] memblock_phys_alloc_range: 4096 bytes align=0x1000 from=0x0000000000000000 max_addr=0x0000000000000000 early_pgtable_alloc+0x24/0x178
> > > [    0.000000] memblock_reserve: [0x000000023fc6b000-0x000000023fc6bfff] memblock_alloc_range_nid+0xc0/0x188
> > > 
> > > Signed-off-by: Faiyaz Mohammed <faiyazm@codeaurora.org>
> > > ---
> > >   mm/memblock.c | 3 +++
> > >   1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/mm/memblock.c b/mm/memblock.c
> > > index 049df41..f65af9f 100644
> > > --- a/mm/memblock.c
> > > +++ b/mm/memblock.c
> > > @@ -1419,6 +1419,9 @@ phys_addr_t __init memblock_phys_alloc_range(phys_addr_t size,
> > >   					     phys_addr_t start,
> > >   					     phys_addr_t end)
> > >   {
> > > +	memblock_dbg("%s: %llu bytes align=0x%llx from=%pa max_addr=%pa %pS\n",
> > > +			__func__, (u64)size, (u64)align, &start, &end,
> > > +			(void *)_RET_IP_);
> > >   	return memblock_alloc_range_nid(size, align, start, end, NUMA_NO_NODE,
> > >   					false);
> > >   }
> > > -- 
> > > QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
> > > member of the Code Aurora Forum, hosted by The Linux Foundation
> > > 

-- 
Sincerely yours,
Mike.


      parent reply	other threads:[~2020-11-11 12:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 12:19 Faiyaz Mohammed
2020-11-10 18:16 ` Mike Rapoport
     [not found]   ` <f1e3c3c8-ed4f-9283-e221-7faec10fdd8d@codeaurora.org>
2020-11-11 12:28     ` Mike Rapoport [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=20201111122843.GH4758@kernel.org \
    --to=rppt@kernel.org \
    --cc=faiyazm@codeaurora.org \
    --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