From: zhong jiang <zhongjiang@huawei.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Michal Hocko <mhocko@kernel.org>,
mgorman@techsingularity.net, Vlastimil Babka <vbabka@suse.cz>,
Minchan Kim <minchan@kernel.org>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: Re: [PATCH] mm: optimize find_zone_movable_pfns_for_nodes to avoid unnecessary loop.
Date: Tue, 9 Aug 2016 20:22:30 +0800 [thread overview]
Message-ID: <57A9CB06.5010201@huawei.com> (raw)
In-Reply-To: <1470405847-53322-1-git-send-email-zhongjiang@huawei.com>
On 2016/8/5 22:04, zhongjiang wrote:
> From: zhong jiang <zhongjiang@huawei.com>
>
> when required_kernelcore decrease to zero, we should exit the loop in time.
> because It will waste time to scan the remainder node.
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
> mm/page_alloc.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index ea759b9..be7df17 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6093,7 +6093,7 @@ static unsigned long __init early_calculate_totalpages(void)
> unsigned long pages = end_pfn - start_pfn;
>
> totalpages += pages;
> - if (pages)
> + if (!node_isset(nid, node_states[N_MEMORY]) && pages)
> node_set_state(nid, N_MEMORY);
> }
> return totalpages;
> @@ -6115,6 +6115,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
> unsigned long totalpages = early_calculate_totalpages();
> int usable_nodes = nodes_weight(node_states[N_MEMORY]);
> struct memblock_region *r;
> + bool avoid_loop = false;
>
> /* Need to find movable_zone earlier when movable_node is specified. */
> find_usable_zone_for_movable();
> @@ -6275,6 +6276,8 @@ restart:
> required_kernelcore -= min(required_kernelcore,
> size_pages);
> kernelcore_remaining -= size_pages;
> + if (!required_kernelcore && avoid_loop)
> + goto out2;
> if (!kernelcore_remaining)
> break;
> }
> @@ -6287,9 +6290,10 @@ restart:
> * satisfied
> */
> usable_nodes--;
> - if (usable_nodes && required_kernelcore > usable_nodes)
> + if (usable_nodes && required_kernelcore > usable_nodes) {
> + avoid_loop = true;
> goto restart;
> -
> + }
> out2:
> /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */
> for (nid = 0; nid < MAX_NUMNODES; nid++)
Any one have any objection about above patch ? please let me know.
--
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>
next prev parent reply other threads:[~2016-08-09 12:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-05 14:04 [PATCH] mm: optimize find_zone_movable_pfns_for_nodes to avoid unnecessary loop zhongjiang
2016-08-09 12:22 ` zhong jiang [this message]
2016-08-09 23:29 ` Andrew Morton
2016-08-10 2:37 ` zhong jiang
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=57A9CB06.5010201@huawei.com \
--to=zhongjiang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@kernel.org \
--cc=minchan@kernel.org \
--cc=vbabka@suse.cz \
/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).