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


Groups > linux.kernel > #1665480

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

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: [RESEND PATCH] base/memory: pass the base_section in add_memory_block
Date Wed, 14 Jun 2017 08:40:01 +0200
Message-ID <tSa89-1FC-11@gated-at.bofh.it> (permalink)
References <tS9lL-1ah-1@gated-at.bofh.it> <tS9F7-1we-1@gated-at.bofh.it>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.23 (2014-03-12)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 46
Organization linux.* mail to news gateway
X-Original-Cc gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org
X-Original-Date Wed, 14 Jun 2017 08:30:38 +0200
X-Original-Message-ID <20170614063038.GE6045@dhcp22.suse.cz>
X-Original-References <20170614054550.14469-1-richard.weiyang@gmail.com> <20170614060558.GA14009@WeideMBP.lan>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1665480

Show key headers only | View raw


On Wed 14-06-17 14:05:58, Wei Yang wrote:
> Hi, Michael
> 
> I copied your reply here:
> 
> >[Sorry for a late response]
> >
> >On Wed 07-06-17 16:52:12, Wei Yang wrote:
> >> 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.
> >
> >Could you be more specific what is the problem here?
> >
> 
> There is no problem in this code. I just find a unnecessary calculation and
> remove it in this patch.

This code needs a larger rething rather than here and there small
changes I believe.

> >> This patch passes the base_section to init_memory_block(), so that to
> >> reduce a local variable and a check in every loop.
> >
> >But then you are not handling a memblock which starts with a !present
> >section. The code is quite hairy but I do not see why your change is any
> 
> I don't see the situation you pointed here.
> 
> In add_memory_block(), section_nr is used to record the first section which is
> present. And this variable is used to calculate the section which is passed to
> init_memory_block().
> 
> In init_memory_block(), the section got from add_memory_block(), is used to
> calculate scn_nr, but finally transformed to "start_section_nr". That means in
> init_memory_block(), we just need the "start_section_nr" of a memory_block. We
> don't care about who is the first present section.

You are right. The code is confusing as hell!

That being said, I am not opposing the patch but I would much rather
appreciate a consistent cleanup in the whole memblock vs. sections area.
That would be a larger project but the end result is really worth it.
-- 
Michal Hocko
SUSE Labs

Back to linux.kernel | Previous | Next — Previous 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