Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1665476

Re: [RESEND PATCH] base/memory: pass the base_section in add_memory_block

From Wei Yang <richard.weiyang@gmail.com>
Newsgroups linux.kernel
Subject Re: [RESEND PATCH] base/memory: pass the base_section in add_memory_block
Date 2017-06-14 08:30 +0200
Message-ID <tS9Yt-1Cw-3@gated-at.bofh.it> (permalink)
References <tS9lL-1ah-1@gated-at.bofh.it> <tS9vw-1dT-55@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RESEND PATCH] base/memory: pass the base_section in add_memory_block Wei Yang <richard.weiyang@gmail.com> - 2017-06-14 07:50 +0200
  Re: [RESEND PATCH] base/memory: pass the base_section in  add_memory_block Michal Hocko <mhocko@kernel.org> - 2017-06-14 08:00 +0200
    Re: [RESEND PATCH] base/memory: pass the base_section in  add_memory_block Michal Hocko <mhocko@kernel.org> - 2017-06-14 08:30 +0200
    Re: [RESEND PATCH] base/memory: pass the base_section in  add_memory_block Wei Yang <richard.weiyang@gmail.com> - 2017-06-14 08:30 +0200
  Re: [RESEND PATCH] base/memory: pass the base_section in  add_memory_block Wei Yang <richard.weiyang@gmail.com> - 2017-06-14 08:10 +0200
    Re: [RESEND PATCH] base/memory: pass the base_section in  add_memory_block Michal Hocko <mhocko@kernel.org> - 2017-06-14 08:40 +0200

csiph-web