linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang@marvell.com>
To: zhouxianrong <zhouxianrong@huawei.com>,
	Chen Feng <puck.chen@hisilicon.com>,
	Catalin Marinas <catalin.marinas@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	srikar@linux.vnet.ibm.com, Mi.Sophia.Wang@huawei.com,
	Will Deacon <will.deacon@arm.com>,
	zhangshiming5@huawei.com, zijun_hu@htc.com,
	won.ho.park@huawei.com,
	Alexander Kuleshov <kuleshovmail@gmail.com>,
	chengang@emindsoft.com.cn, zhouxiyu@huawei.com, tj@kernel.org,
	weidu.du@huawei.com,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Steve Capper <steve.capper@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Joe Perches <joe@perches.com>, Dennis Chen <dennis.chen@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
Subject: Re: [PATCH] mm: free reserved area's memmap if possiable
Date: Wed, 1 Mar 2017 18:41:40 +0800	[thread overview]
Message-ID: <20170301184140.7ac9de0a@xhacker> (raw)
In-Reply-To: <a9c03f7d-355b-76c4-2a3a-771d57af1591@huawei.com>

Add Chen, Catalin

On Thu, 16 Feb 2017 09:11:29 +0800 zhouxianrong wrote:
> 
> 
> On 2017/2/15 15:10, Ard Biesheuvel wrote:
> > On 15 February 2017 at 01:44, zhouxianrong wrote:  
> >>
> >>
> >> On 2017/2/14 17:03, Ard Biesheuvel wrote:  
> >>>
> >>> On 14 February 2017 at 06:53,  <zhouxianrong@huawei.com> wrote:  
> >>>>
> >>>> From: zhouxianrong <zhouxianrong@huawei.com>
> >>>>
> >>>> just like freeing no-map area's memmap (gaps of memblock.memory)
> >>>> we could free reserved area's memmap (areas of memblock.reserved)
> >>>> as well only when user of reserved area indicate that we can do
> >>>> this in drivers. that is, user of reserved area know how to
> >>>> use the reserved area who could not memblock_free or free_reserved_xxx
> >>>> the reserved area and regard the area as raw pfn usage by kernel.
> >>>> the patch supply a way to users who want to utilize the memmap
> >>>> memory corresponding to raw pfn reserved areas as many as possible.
> >>>> users can do this by memblock_mark_raw_pfn interface which mark the
> >>>> reserved area as raw pfn and tell free_unused_memmap that this area's
> >>>> memmap could be freeed.
> >>>>  
> >>>
> >>> Could you give an example how much memory we actually recover by doing
> >>> this? I understand it depends on the size of the reserved regions, but
> >>> I'm sure you have an actual example that inspired you to write this
> >>> patch.  
> >>
> >>
> >> i did statistics in our platform, the memmap of reserved region that can be
> >> freed
> >> is about 6MB. it's fewer.

<...>

> >>> In any case, it is good to emphasize that on 4 KB pagesize kernels, we
> >>> will only free multiples of 8 MB that are 8 MB aligned, resulting in
> >>> 128 KB of memmap backing to be released.  
> >>
> >>
> >>  
> >>>
> >>>  
> >>>> +               if (start < end)
> >>>> +                       free_memmap(start, end);
> >>>> +       }
> >>>>  }
> >>>>  #endif /* !CONFIG_SPARSEMEM_VMEMMAP */
> >>>>
> >>>> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> >>>> index 5b759c9..9f8d277 100644
> >>>> --- a/include/linux/memblock.h
> >>>> +++ b/include/linux/memblock.h
> >>>> @@ -26,6 +26,7 @@ enum {
> >>>>         MEMBLOCK_HOTPLUG        = 0x1,  /* hotpluggable region */
> >>>>         MEMBLOCK_MIRROR         = 0x2,  /* mirrored region */
> >>>>         MEMBLOCK_NOMAP          = 0x4,  /* don't add to kernel direct
> >>>> mapping */
> >>>> +       MEMBLOCK_RAW_PFN        = 0x8,  /* region whose memmap never be
> >>>> used */  
> >>>
> >>>
> >>> I think we should be *very* careful about the combinatorial explosion
> >>> that results when combining all these flags, given that this is not a
> >>> proper enum but a bit field.
> >>>
> >>> In any case, the generic memblock change should be in a separate patch
> >>> from the arm64 change.  
> >>
> >>
> >> MEMBLOCK_RAW_PFN and MEMBLOCK_NOMAP can not be set at the same time
> >>  
> >
> > They should not. But if I call  memblock_mark_raw_pfn() on a
> > MEMBLOCK_NOMAP region, it will have both flags set.
> >
> > In summary, I don't think we need this patch. And if you can convince
> > us otherwise, you should really be more methodical and explicit in
> > implementing this RAW_PFN flag, not add it as a byproduct of the arch
> > code that uses it. Also, you should explain how RAW_PFN relates to
> > NOMAP, and ensure that RAW_PFN and NOMAP regions don't intersect if
> > that is an unsupported combination.  
> 
> yes, setting both MEMBLOCK_RAW_PFN and MEMBLOCK_NOMAP could meet some problems
> when gaps of memblock.memory intersect memblock.reserved. if they do not intersect,
> that's ok. so as you said this should be carefully considered.
> 
> as you think this patch is not needed because, i have showed my idea, it's enough, thanks!

we are also interested in this area.

Just curious, is this patch to "free the vmemmap holes" mentioned by
by Catalin in [1]?

[1]http://lkml.iu.edu/hypermail/linux/kernel/1604.1/03036.html

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-03-01 10:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 12:02 [PATCH] mm: free reserved area's memmap if possiable zhouxianrong
2017-02-13 12:17 ` Will Deacon
2017-02-13 12:24   ` Russell King - ARM Linux
2017-02-13 14:54 ` kbuild test robot
2017-02-14  6:53 ` zhouxianrong
2017-02-14  7:18   ` zhouxianrong
2017-02-14  9:03   ` Ard Biesheuvel
2017-02-15  1:44     ` zhouxianrong
2017-02-15  7:10       ` Ard Biesheuvel
2017-02-16  1:11         ` zhouxianrong
2017-03-01 10:41           ` Jisheng Zhang [this message]
2017-03-02  6:00             ` zhouxianrong

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=20170301184140.7ac9de0a@xhacker \
    --to=jszhang@marvell.com \
    --cc=Mi.Sophia.Wang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=chengang@emindsoft.com.cn \
    --cc=dennis.chen@arm.com \
    --cc=gkulkarni@caviumnetworks.com \
    --cc=joe@perches.com \
    --cc=kuleshovmail@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mark.rutland@arm.com \
    --cc=puck.chen@hisilicon.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=steve.capper@arm.com \
    --cc=tj@kernel.org \
    --cc=wangkefeng.wang@huawei.com \
    --cc=weidu.du@huawei.com \
    --cc=will.deacon@arm.com \
    --cc=won.ho.park@huawei.com \
    --cc=zhangshiming5@huawei.com \
    --cc=zhouxianrong@huawei.com \
    --cc=zhouxiyu@huawei.com \
    --cc=zijun_hu@htc.com \
    /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;
as well as URLs for NNTP newsgroup(s).