linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: John Hubbard <jhubbard@nvidia.com>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: mhocko@suse.com, linux-mm@kvack.org
Subject: Re: [RFC PATCH 1/4] mm/hotplug: aligne the hotplugable range with memory_block
Date: Sun, 25 Jun 2017 23:49:21 -0700	[thread overview]
Message-ID: <35dd30c8-b31d-b8da-903a-0ea7eafb7e04@nvidia.com> (raw)
In-Reply-To: <20170626002006.GA47120@WeideMacBook-Pro.local>

On 06/25/2017 05:20 PM, Wei Yang wrote:
> * PGP Signed by an unknown key
> 
> On Sat, Jun 24, 2017 at 08:31:20PM -0700, John Hubbard wrote:
>> On 06/24/2017 07:52 PM, Wei Yang wrote:
>>> memory hotplug is memory block aligned instead of section aligned.
>>>
>>> This patch fix the range check during hotplug.
>>>
>>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>>> ---
>>>  drivers/base/memory.c  | 3 ++-
>>>  include/linux/memory.h | 2 ++
>>>  mm/memory_hotplug.c    | 9 +++++----
>>>  3 files changed, 9 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
>>> index c7c4e0325cdb..b54cfe9cd98b 100644
>>> --- a/drivers/base/memory.c
>>> +++ b/drivers/base/memory.c
>>> @@ -31,7 +31,8 @@ static DEFINE_MUTEX(mem_sysfs_mutex);
>>>  
>>>  #define to_memory_block(dev) container_of(dev, struct memory_block, dev)
>>>  
>>> -static int sections_per_block;
>>> +int sections_per_block;
>>> +EXPORT_SYMBOL(sections_per_block);
>>
>> Hi Wei,
>>
>> Is sections_per_block ever assigned a value? I am not seeing that happen,
>> either in this patch, or in the larger patchset.
>>
> 
> This is assigned in memory_dev_init(). Not in my patch.
> 

ah, there it is, thanks. (I misread the diff slightly and thought you were adding that
variable, but I see it's actually been there forever.)  

thanks
john h

>>
>>>  
>>>  static inline int base_memory_block_id(int section_nr)
>>>  {
>>> diff --git a/include/linux/memory.h b/include/linux/memory.h
>>> index b723a686fc10..51a6355aa56d 100644
>>> --- a/include/linux/memory.h
>>> +++ b/include/linux/memory.h
>>> @@ -142,4 +142,6 @@ extern struct memory_block *find_memory_block(struct mem_section *);
>>>   */
>>>  extern struct mutex text_mutex;
>>>  
>>> +extern int sections_per_block;
>>> +
>>>  #endif /* _LINUX_MEMORY_H_ */
>>> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>>> index 387ca386142c..f5d06afc8645 100644
>>> --- a/mm/memory_hotplug.c
>>> +++ b/mm/memory_hotplug.c
>>> @@ -1183,11 +1183,12 @@ static int check_hotplug_memory_range(u64 start, u64 size)
>>>  {
>>>  	u64 start_pfn = PFN_DOWN(start);
>>>  	u64 nr_pages = size >> PAGE_SHIFT;
>>> +	u64 page_per_block = sections_per_block * PAGES_PER_SECTION;
>>
>> "pages_per_block" would be a little better.
>>
>> Also, in the first line of the commit, s/aligne/align/.
> 
> Good, thanks.
> 
>>
>> thanks,
>> john h
>>
>>>  
>>> -	/* Memory range must be aligned with section */
>>> -	if ((start_pfn & ~PAGE_SECTION_MASK) ||
>>> -	    (nr_pages % PAGES_PER_SECTION) || (!nr_pages)) {
>>> -		pr_err("Section-unaligned hotplug range: start 0x%llx, size 0x%llx\n",
>>> +	/* Memory range must be aligned with memory_block */
>>> +	if ((start_pfn & (page_per_block - 1)) ||
>>> +	    (nr_pages % page_per_block) || (!nr_pages)) {
>>> +		pr_err("Memory_block-unaligned hotplug range: start 0x%llx, size 0x%llx\n",
>>>  				(unsigned long long)start,
>>>  				(unsigned long long)size);
>>>  		return -EINVAL;
>>>
> 

--
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>

  reply	other threads:[~2017-06-26  6:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-25  2:52 [RFC PATCH 0/4] mm/hotplug: make hotplug memory_block alligned Wei Yang
2017-06-25  2:52 ` [RFC PATCH 1/4] mm/hotplug: aligne the hotplugable range with memory_block Wei Yang
2017-06-25  3:31   ` John Hubbard
2017-06-26  0:20     ` Wei Yang
2017-06-26  6:49       ` John Hubbard [this message]
2017-06-26 23:21         ` Wei Yang
2017-06-25  2:52 ` [RFC PATCH 2/4] mm/hotplug: walk_memroy_range on memory_block uit Wei Yang
2017-06-26  7:32   ` John Hubbard
2017-06-26 23:40     ` Wei Yang
2017-06-27  6:59       ` John Hubbard
2017-06-28  0:11         ` Wei Yang
2017-06-25  2:52 ` [RFC PATCH 3/4] mm/hotplug: make __add_pages() iterate on memory_block and split __add_section() Wei Yang
2017-06-26  7:50   ` John Hubbard
2017-06-26 23:53     ` Wei Yang
2017-06-27  6:47       ` John Hubbard
2017-06-28  0:16         ` Wei Yang
2017-06-28  0:22   ` Wei Yang
2017-06-25  2:52 ` [RFC PATCH 4/4] base/memory: pass start_section_nr to init_memory_block() Wei Yang
2017-06-27  7:11   ` John Hubbard
2017-06-28  0:18     ` Wei Yang
2017-06-26  7:46 ` [RFC PATCH 0/4] mm/hotplug: make hotplug memory_block alligned Michal Hocko
2017-06-27  2:13   ` Wei Yang
2017-06-28  9:43     ` 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=35dd30c8-b31d-b8da-903a-0ea7eafb7e04@nvidia.com \
    --to=jhubbard@nvidia.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=richard.weiyang@gmail.com \
    /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).