All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Robin Holt <robin.m.holt@gmail.com>,
	Nathan Zimmer <nzimmer@sgi.com>
Cc: Jiang Liu <liuj97@gmail.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>, Mel Gorman <mgorman@suse.de>
Subject: New helper to free highmem pages in larger chunks
Date: Sat, 3 Oct 2015 18:25:13 +0530	[thread overview]
Message-ID: <560FD031.3030909@synopsys.com> (raw)

Hi,

I noticed increased boot time when enabling highmem for ARC. Turns out that
freeing highmem pages into buddy allocator is done page at a time, while it is
batched for low mem pages. Below is call flow.

I'm thinking of writing free_highmem_pages() which takes start and end pfn and
want to solicit some ideas whether to write it from scratch or preferably call
existing __free_pages_memory() to reuse the logic to convert a pfn range into
{pfn, order} tuples.

For latter however there are semantical differences as you can see below which I'm
not sure of:
  -highmem page->count is set to 1, while 0 for low mem
  -atomic clearing of page reserved flag vs. non atomic


mem_init
     for (tmp = min_high_pfn; tmp < max_pfn; tmp++)
	free_highmem_page(pfn_to_page(tmp));
	     __free_reserved_page
		ClearPageReserved(page);   <--- atomic
		init_page_count(page);  <-- _count = 1
		__free_page(page);    <-- free SINGLE page


     free_all_bootmem
	free_low_memory_core_early
	   __free_memory_core(start, end)
	       __free_pages_memory(s_pfn, e_pfn) <- creates "order" sized batches
		    __free_pages_bootmem(pfn, order)
		        __free_pages_boot_core(start_page, start_pfn, order)
				loops from 0 to (1 << order)
				    __ClearPageReserved(p);   <-- non atomic
				    set_page_count(p, 0);  <--- _count = 0

				__free_pages(page, order);    <--- free BATCH

WARNING: multiple messages have this Message-ID (diff)
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Robin Holt <robin.m.holt@gmail.com>,
	Nathan Zimmer <nzimmer@sgi.com>
Cc: Jiang Liu <liuj97@gmail.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>, Mel Gorman <mgorman@suse.de>
Subject: New helper to free highmem pages in larger chunks
Date: Sat, 3 Oct 2015 18:25:13 +0530	[thread overview]
Message-ID: <560FD031.3030909@synopsys.com> (raw)

Hi,

I noticed increased boot time when enabling highmem for ARC. Turns out that
freeing highmem pages into buddy allocator is done page at a time, while it is
batched for low mem pages. Below is call flow.

I'm thinking of writing free_highmem_pages() which takes start and end pfn and
want to solicit some ideas whether to write it from scratch or preferably call
existing __free_pages_memory() to reuse the logic to convert a pfn range into
{pfn, order} tuples.

For latter however there are semantical differences as you can see below which I'm
not sure of:
  -highmem page->count is set to 1, while 0 for low mem
  -atomic clearing of page reserved flag vs. non atomic


mem_init
     for (tmp = min_high_pfn; tmp < max_pfn; tmp++)
	free_highmem_page(pfn_to_page(tmp));
	     __free_reserved_page
		ClearPageReserved(page);   <--- atomic
		init_page_count(page);  <-- _count = 1
		__free_page(page);    <-- free SINGLE page


     free_all_bootmem
	free_low_memory_core_early
	   __free_memory_core(start, end)
	       __free_pages_memory(s_pfn, e_pfn) <- creates "order" sized batches
		    __free_pages_bootmem(pfn, order)
		        __free_pages_boot_core(start_page, start_pfn, order)
				loops from 0 to (1 << order)
				    __ClearPageReserved(p);   <-- non atomic
				    set_page_count(p, 0);  <--- _count = 0

				__free_pages(page, order);    <--- free BATCH

--
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:[~2015-10-03 12:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-03 12:55 Vineet Gupta [this message]
2015-10-03 12:55 ` New helper to free highmem pages in larger chunks Vineet Gupta
2015-10-05 22:09 ` Andrew Morton
2015-10-05 22:09   ` Andrew Morton
2015-10-06  5:35   ` Vineet Gupta
2015-10-06  5:35     ` Vineet Gupta
2015-10-06  8:42     ` [arc-linux-dev] " Vineet Gupta
2015-10-06  8:42       ` Vineet Gupta

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=560FD031.3030909@synopsys.com \
    --to=vineet.gupta1@synopsys.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuj97@gmail.com \
    --cc=mgorman@suse.de \
    --cc=nzimmer@sgi.com \
    --cc=robin.m.holt@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.