linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Wang, Yalin" <Yalin.Wang@sonymobile.com>
To: 'Minchan Kim' <minchan@kernel.org>
Cc: "'mhocko@suse.cz'" <mhocko@suse.cz>,
	"'linux-mm@kvack.org'" <linux-mm@kvack.org>,
	"'akpm@linux-foundation.org'" <akpm@linux-foundation.org>,
	"mm-commits@vger.kernel.org" <mm-commits@vger.kernel.org>,
	"hughd@google.com" <hughd@google.com>,
	"b.zolnierkie@samsung.com" <b.zolnierkie@samsung.com>
Subject: RE: [RFC] Free the reserved memblock when free cma pages
Date: Mon, 15 Sep 2014 13:46:40 +0800	[thread overview]
Message-ID: <35FD53F367049845BC99AC72306C23D103D6DB4915FE@CNBJMBX05.corpusers.net> (raw)
In-Reply-To: <20140915054236.GJ2160@bbox>

Hi Kim,

Oh, my mistake,
I see your meaning,
I will resend a new patch.

Thanks for your advice.

-----Original Message-----
On Mon, Sep 15, 2014 at 01:36:13PM +0800, Wang, Yalin wrote:
> Hi Kim,
> 
> I think move memblock_free into init_cma_reserved_pageblock Is not a 
> good idea, Because this will need call memblock_free for Every page 
> release, Think that for a 4MB memory, need call memblock_free
> 1024 times , instead, we just call memblock_free one Time for every 
> pageblock_nr_pages pages .

Why?

diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1953a243836b..876b789378af 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -848,6 +848,9 @@ void __init init_cma_reserved_pageblock(struct page *page)
 	}
 
 	adjust_managed_page_count(page, pageblock_nr_pages);
+	memblock_free(page_to_phys(page),
+				pageblock_nr_pages * PAGE_SIZE);
+
 }
 #endif
 
> 
> I will add some descriptions in cma_declare_contiguous For patch 
> version 2 .
> 
> Thanks
> 
> -----Original Message-----
> Hello,
> 
> On Tue, Sep 09, 2014 at 02:13:58PM +0800, Wang, Yalin wrote:
> > This patch add memblock_free to also free the reserved memblock, so 
> > that the cma pages are not marked as reserved memory in 
> > /sys/kernel/debug/memblock/reserved debug file
> > 
> > Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com>
> > ---
> >  mm/cma.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/mm/cma.c b/mm/cma.c
> > index c17751c..f3ec756 100644
> > --- a/mm/cma.c
> > +++ b/mm/cma.c
> > @@ -114,6 +114,8 @@ static int __init cma_activate_area(struct cma *cma)
> >  				goto err;
> >  		}
> >  		init_cma_reserved_pageblock(pfn_to_page(base_pfn));
> > +		memblock_free(__pfn_to_phys(base_pfn),
> > +				pageblock_nr_pages * PAGE_SIZE);
> 
> Nitpick:
> 
> Couldn't we add memblock_free into init_cma_reserved_pageblock?
> Because it should be pair with ClearPageReserved, I think.
> 
> In addition, please add description on memory reserve part in cma_declare_contiguous.
> 
> >  	} while (--i);
> >  
> >  	mutex_init(&cma->lock);
> > --
> > 2.1.0
> > 
> > --
> > 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>
> 
> --
> Kind regards,
> Minchan Kim

--
Kind regards,
Minchan Kim

  reply	other threads:[~2014-09-15  5:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09  6:13 Wang, Yalin
2014-09-10  8:18 ` Michal Hocko
2014-09-10  9:02   ` Wang, Yalin
2014-09-12  9:35 ` Marek Szyprowski
2014-09-15  3:06   ` Joonsoo Kim
2014-09-15  5:21 ` Minchan Kim
2014-09-15  5:36   ` Wang, Yalin
2014-09-15  5:42     ` Minchan Kim
2014-09-15  5:46       ` Wang, Yalin [this message]
2014-09-15  6:10       ` [RFC V2] " Wang, Yalin
2014-09-15  6:57         ` Minchan Kim
2014-09-15  7:54         ` [PATCH Resend] " Wang, Yalin

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=35FD53F367049845BC99AC72306C23D103D6DB4915FE@CNBJMBX05.corpusers.net \
    --to=yalin.wang@sonymobile.com \
    --cc=akpm@linux-foundation.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=hughd@google.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=minchan@kernel.org \
    --cc=mm-commits@vger.kernel.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