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: always inline memblock_alloc
Date: Wed, 11 Nov 2020 14:34:28 +0200	[thread overview]
Message-ID: <20201111123428.GI4758@kernel.org> (raw)
In-Reply-To: <97ca3445-c405-cdc1-b9e6-6ed2386c9c57@codeaurora.org>

On Wed, Nov 11, 2020 at 03:15:11PM +0530, Faiyaz Mohammed wrote:
> 
> On 11/11/2020 12:11 AM, Mike Rapoport wrote:
> > Hi,
> > 
> > On Tue, Nov 10, 2020 at 05:50:17PM +0530, Faiyaz Mohammed wrote:
> > > Since memblock_alloc is not getting inlined, memblock_reserve owner info
> > > is lost. Below information is not enough for memory accounting.
> > > for example:
> > > [    0.000000] memblock_alloc_try_nid: 1490 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 memblock_alloc+0x20/0x2c
> > > [    0.000000] memblock_reserve: [0x000000023f09a3c0-0x000000023f09a991] memblock_alloc_range_nid+0xc0/0x188
> > > 
> > > Add "__always_inline" to make sure it get inlined and to get the exact
> > > owner of the memblock_reserve.
> > > After adding __always_inline:
> > > [    0.000000] memblock_alloc_try_nid: 1490 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 start_kernel+0xa4/0x568
> > > [    0.000000] memblock_reserve: [0x000000023f09a3c0-0x000000023f09a991] memblock_alloc_range_nid+0xc0/0x188
> > I agree that making memblock_alloc() inline as well as other similar
> > wrappers would improve the debugability.
> > Still, it has nothing to do with memory accounting and owner tracking.
> > Please update the patch description to better explain what it actually
> > improves.
> 
> As describe in other thread, 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.
> > 
> > > Signed-off-by: Faiyaz Mohammed <faiyazm@codeaurora.org>
> > > ---
> > >   include/linux/memblock.h | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> > > index ef13125..54f9544 100644
> > > --- a/include/linux/memblock.h
> > > +++ b/include/linux/memblock.h
> > > @@ -404,7 +404,7 @@ void *memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align,
> > >   			     phys_addr_t min_addr, phys_addr_t max_addr,
> > >   			     int nid);
> > > -static inline void * __init memblock_alloc(phys_addr_t size,  phys_addr_t align)
> > > +static __always_inline void * __init memblock_alloc(phys_addr_t size,  phys_addr_t align)
> > I think simply dropping __init here will make memblock_alloc() inline.
> > There are also several more convenience wrappers marked __init, do you
> > mind removing the __init annotation for them as well?
> 
> Yes, if we drop __init, memblock_alloc will get inline but would it not
> increase
> kernel footprint as the function will no more be released after kernel init?

If memblock_alloc(), or any other function for that matter, is inlined,
it does not have an entry in the object file, but it is rather inserted
at the call sites.

The functions that use memblock_alloc() may change, but they all should
be __init anyway so I won't expect increase in the kernel post-init
memory footprint.


> > >   {
> > >   	return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT,
> > >   				      MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE);

-- 
Sincerely yours,
Mike.


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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 12:20 Faiyaz Mohammed
2020-11-10 18:41 ` Mike Rapoport
     [not found]   ` <97ca3445-c405-cdc1-b9e6-6ed2386c9c57@codeaurora.org>
2020-11-11 12:34     ` 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=20201111123428.GI4758@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