From: Wei Yang <richard.weiyang@gmail.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Wei Yang <richard.weiyang@gmail.com>,
akpm@linux-foundation.org, tj@kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm/page_alloc: break on the first hit of mem range
Date: Wed, 28 Mar 2018 21:17:14 +0800 [thread overview]
Message-ID: <20180328131714.GA543@WeideMacBook-Pro.local> (raw)
In-Reply-To: <20180328070200.GC9275@dhcp22.suse.cz>
On Wed, Mar 28, 2018 at 09:02:00AM +0200, Michal Hocko wrote:
>On Wed 28-03-18 08:39:36, Wei Yang wrote:
>> On Tue, Mar 27, 2018 at 12:58:21PM +0200, Michal Hocko wrote:
>> >On Tue 27-03-18 11:57:07, Wei Yang wrote:
>> >> find_min_pfn_for_node() iterate on pfn range to find the minimum pfn for a
>> >> node. The memblock_region in memblock_type are already ordered, which means
>> >> the first hit in iteration is the minimum pfn.
>> >
>> >I haven't looked at the code yet but the changelog should contain the
>> >motivation why it exists. It seems like this is an optimization. If so,
>> >what is the impact?
>> >
>>
>> Yep, this is a trivial optimization on searching the minimal pfn on a special
>> node. It would be better for audience to understand if I put some words in
>> change log.
>>
>> The impact of this patch is it would accelerate the searching process when
>> there are many memory ranges in memblock.
>>
>> For example, in the case https://lkml.org/lkml/2018/3/25/291, there are around
>> 30 memory ranges on node 0. The original code need to iterate all those ranges
>> to find the minimal pfn, while after optimization it just need once.
>
>Then show us some numbers to justify the change.
Oops, I don't have any data to prove this.
My test machine just has 7 memory regions and only one node. So it reduce
iteration from 7 to 1, which I don't think will have some visible effect.
While we can do some calculation to estimate the effect.
Assume there are N memory regions and M nodes and each node has equal number
of memory regions.
So before the change, there are
N * M iterations
After this optimization, there are
(N / 2) * M iterations
So the expected improvement of this change is half the iterations for finding
the minimal pfn.
Last but not the least, as I know, usually there are less than 100 memory
regions on a machine. This improvement is really limited on current systems.
The more memory regions and node a system has, the more improvement it will
has.
>--
>Michal Hocko
>SUSE Labs
--
Wei Yang
Help you, Help me
next prev parent reply other threads:[~2018-03-28 13:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-27 3:57 [PATCH] mm/page_alloc: break on the first hit of mem range Wei Yang
2018-03-27 10:58 ` Michal Hocko
2018-03-28 0:39 ` Wei Yang
2018-03-28 7:02 ` Michal Hocko
2018-03-28 13:17 ` Wei Yang [this message]
2018-03-27 22:47 ` Andrew Morton
2018-03-28 0:51 ` Wei Yang
2018-03-28 1:37 ` Andrew Morton
2018-03-28 3:44 ` Wei Yang
2018-03-28 3:47 ` [PATCH] mm/page_alloc: optimize find_min_pfn_for_node() by geting the minimal pfn directly Wei Yang
2018-03-28 11:58 ` Michal Hocko
2018-03-28 13:34 ` Wei Yang
2018-03-28 14:02 ` Michal Hocko
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=20180328131714.GA543@WeideMacBook-Pro.local \
--to=richard.weiyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=tj@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;
as well as URLs for NNTP newsgroup(s).