linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Wei Yang <richard.weiyang@gmail.com>,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [RESEND PATCH] base/memory: pass the base_section in add_memory_block
Date: Wed, 14 Jun 2017 14:19:59 +0800	[thread overview]
Message-ID: <20170614061959.GD14009@WeideMBP.lan> (raw)
In-Reply-To: <20170614055925.GA6045@dhcp22.suse.cz>

[-- Attachment #1: Type: text/plain, Size: 2114 bytes --]

On Wed, Jun 14, 2017 at 07:59:25AM +0200, Michal Hocko wrote:
>On Wed 14-06-17 13:45:50, Wei Yang wrote:
>> Based on Greg's comment, cc it to mm list.
>> The original thread could be found https://lkml.org/lkml/2017/6/7/202
>

Wow, you are still working~ I just moved your response in this thread~

So that other audience would be convenient to see the whole story.

>I have already given you feedback
>http://lkml.kernel.org/r/20170613114842.GI10819@dhcp22.suse.cz
>and you seemed to ignore it completely.
>
>> The second parameter of init_memory_block() is used to calculate the
>> start_section_nr of this block, which means any section in the same block
>> would get the same start_section_nr.
>> 
>> This patch passes the base_section to init_memory_block(), so that to
>> reduce a local variable and a check in every loop.
>> 
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> ---
>>  drivers/base/memory.c | 7 +++----
>>  1 file changed, 3 insertions(+), 4 deletions(-)
>> 
>> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
>> index cc4f1d0cbffe..1e903aba2aa1 100644
>> --- a/drivers/base/memory.c
>> +++ b/drivers/base/memory.c
>> @@ -664,21 +664,20 @@ static int init_memory_block(struct memory_block **memory,
>>  static int add_memory_block(int base_section_nr)
>>  {
>>  	struct memory_block *mem;
>> -	int i, ret, section_count = 0, section_nr;
>> +	int i, ret, section_count = 0;
>>  
>>  	for (i = base_section_nr;
>>  	     (i < base_section_nr + sections_per_block) && i < NR_MEM_SECTIONS;
>>  	     i++) {
>>  		if (!present_section_nr(i))
>>  			continue;
>> -		if (section_count == 0)
>> -			section_nr = i;
>>  		section_count++;
>>  	}
>>  
>>  	if (section_count == 0)
>>  		return 0;
>> -	ret = init_memory_block(&mem, __nr_to_section(section_nr), MEM_ONLINE);
>> +	ret = init_memory_block(&mem, __nr_to_section(base_section_nr),
>> +				MEM_ONLINE);
>>  	if (ret)
>>  		return ret;
>>  	mem->section_count = section_count;
>> -- 
>> 2.11.0
>
>-- 
>Michal Hocko
>SUSE Labs

-- 
Wei Yang
Help you, Help me

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2017-06-14  6:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14  5:45 Wei Yang
2017-06-14  5:59 ` Michal Hocko
2017-06-14  6:19   ` Wei Yang [this message]
2017-06-14  6:22     ` Michal Hocko
2017-06-14  6:05 ` Wei Yang
2017-06-14  6:30   ` 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=20170614061959.GD14009@WeideMBP.lan \
    --to=richard.weiyang@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@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