All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/sparse: set section nid for hot-add memory
@ 2019-06-16  2:35 Wei Yang
  2019-06-17  4:23 ` Anshuman Khandual
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Wei Yang @ 2019-06-16  2:35 UTC (permalink / raw)
  To: linux-mm; +Cc: akpm, pasha.tatashin, osalvador, Wei Yang

section_to_node_table[] is used to record section's node id, which is
used in page_to_nid(). While for hot-add memory, this is missed.

BTW, current online_pages works because it leverages nid in memory_block.
But the granularity of node id should be mem_section wide.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 mm/sparse.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/sparse.c b/mm/sparse.c
index fd13166949b5..3ba8f843cb7a 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -735,6 +735,7 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn,
 	 */
 	page_init_poison(memmap, sizeof(struct page) * PAGES_PER_SECTION);
 
+	set_section_nid(section_nr, nid);
 	section_mark_present(ms);
 	sparse_init_one_section(ms, section_nr, memmap, usemap);
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm/sparse: set section nid for hot-add memory
  2019-06-16  2:35 [PATCH] mm/sparse: set section nid for hot-add memory Wei Yang
@ 2019-06-17  4:23 ` Anshuman Khandual
  2019-06-17  8:46   ` Wei Yang
  2019-06-17 13:13 ` David Hildenbrand
  2019-06-17 15:43 ` Oscar Salvador
  2 siblings, 1 reply; 7+ messages in thread
From: Anshuman Khandual @ 2019-06-17  4:23 UTC (permalink / raw)
  To: Wei Yang, linux-mm; +Cc: akpm, pasha.tatashin, osalvador

On 06/16/2019 08:05 AM, Wei Yang wrote:
> section_to_node_table[] is used to record section's node id, which is
> used in page_to_nid(). While for hot-add memory, this is missed.

Used for NODE_NOT_IN_PAGE_FLAGS case and it is missed for hot-added memory.

> 
> BTW, current online_pages works because it leverages nid in memory_block.

It does.

> But the granularity of node id should be mem_section wide.

Right.

> 
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm/sparse: set section nid for hot-add memory
  2019-06-17  4:23 ` Anshuman Khandual
@ 2019-06-17  8:46   ` Wei Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Wei Yang @ 2019-06-17  8:46 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: Wei Yang, linux-mm, akpm, pasha.tatashin, osalvador

On Mon, Jun 17, 2019 at 09:53:05AM +0530, Anshuman Khandual wrote:
>On 06/16/2019 08:05 AM, Wei Yang wrote:
>> section_to_node_table[] is used to record section's node id, which is
>> used in page_to_nid(). While for hot-add memory, this is missed.
>
>Used for NODE_NOT_IN_PAGE_FLAGS case and it is missed for hot-added memory.
>
>> 
>> BTW, current online_pages works because it leverages nid in memory_block.
>
>It does.
>
>> But the granularity of node id should be mem_section wide.
>
>Right.
>
>> 
>> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>
>Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

Thanks

-- 
Wei Yang
Help you, Help me


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm/sparse: set section nid for hot-add memory
  2019-06-16  2:35 [PATCH] mm/sparse: set section nid for hot-add memory Wei Yang
  2019-06-17  4:23 ` Anshuman Khandual
@ 2019-06-17 13:13 ` David Hildenbrand
  2019-06-18  0:36   ` Wei Yang
  2019-06-17 15:43 ` Oscar Salvador
  2 siblings, 1 reply; 7+ messages in thread
From: David Hildenbrand @ 2019-06-17 13:13 UTC (permalink / raw)
  To: Wei Yang, linux-mm; +Cc: akpm, pasha.tatashin, osalvador

On 16.06.19 04:35, Wei Yang wrote:
> section_to_node_table[] is used to record section's node id, which is
> used in page_to_nid(). While for hot-add memory, this is missed.
> 
> BTW, current online_pages works because it leverages nid in memory_block.
> But the granularity of node id should be mem_section wide.

set_section_nid() is only relevant if the NID is not part of the vmemmaps.

> 
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> ---
>  mm/sparse.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/sparse.c b/mm/sparse.c
> index fd13166949b5..3ba8f843cb7a 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -735,6 +735,7 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn,
>  	 */
>  	page_init_poison(memmap, sizeof(struct page) * PAGES_PER_SECTION);
>  
> +	set_section_nid(section_nr, nid);
>  	section_mark_present(ms);
>  	sparse_init_one_section(ms, section_nr, memmap, usemap);
>  
> 

Although I dislike basically all of the current ->nid design, this seems
to be the right thing to do

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm/sparse: set section nid for hot-add memory
  2019-06-16  2:35 [PATCH] mm/sparse: set section nid for hot-add memory Wei Yang
  2019-06-17  4:23 ` Anshuman Khandual
  2019-06-17 13:13 ` David Hildenbrand
@ 2019-06-17 15:43 ` Oscar Salvador
  2019-06-18  0:45   ` Wei Yang
  2 siblings, 1 reply; 7+ messages in thread
From: Oscar Salvador @ 2019-06-17 15:43 UTC (permalink / raw)
  To: Wei Yang; +Cc: linux-mm, akpm, pasha.tatashin

On Sun, Jun 16, 2019 at 10:35:54AM +0800, Wei Yang wrote:
> section_to_node_table[] is used to record section's node id, which is
> used in page_to_nid(). While for hot-add memory, this is missed.
> 
> BTW, current online_pages works because it leverages nid in memory_block.
> But the granularity of node id should be mem_section wide.
> 
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>

While the patch is valid, I think that the changelog could be improved a bit.
For example, I would point out the possible problems we can face if it is not set
properly (e.g: page_to_nid() operations failing to give the right node) and when
section_to_node_table[] is used (NODE_NOT_IN_PAGE_FLAGS scenario).

Reviewed-by: Oscar Salvador <osalvador@suse.de>

> ---
>  mm/sparse.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/sparse.c b/mm/sparse.c
> index fd13166949b5..3ba8f843cb7a 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -735,6 +735,7 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn,
>  	 */
>  	page_init_poison(memmap, sizeof(struct page) * PAGES_PER_SECTION);
>  
> +	set_section_nid(section_nr, nid);
>  	section_mark_present(ms);
>  	sparse_init_one_section(ms, section_nr, memmap, usemap);
>  
> -- 
> 2.19.1
> 

-- 
Oscar Salvador
SUSE L3


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm/sparse: set section nid for hot-add memory
  2019-06-17 13:13 ` David Hildenbrand
@ 2019-06-18  0:36   ` Wei Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Wei Yang @ 2019-06-18  0:36 UTC (permalink / raw)
  To: David Hildenbrand; +Cc: Wei Yang, linux-mm, akpm, pasha.tatashin, osalvador

On Mon, Jun 17, 2019 at 03:13:33PM +0200, David Hildenbrand wrote:
>On 16.06.19 04:35, Wei Yang wrote:
>> section_to_node_table[] is used to record section's node id, which is
>> used in page_to_nid(). While for hot-add memory, this is missed.
>> 
>> BTW, current online_pages works because it leverages nid in memory_block.
>> But the granularity of node id should be mem_section wide.
>
>set_section_nid() is only relevant if the NID is not part of the vmemmaps.
>

Yep, you are right.

>> 
>> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>> ---
>>  mm/sparse.c | 1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/mm/sparse.c b/mm/sparse.c
>> index fd13166949b5..3ba8f843cb7a 100644
>> --- a/mm/sparse.c
>> +++ b/mm/sparse.c
>> @@ -735,6 +735,7 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn,
>>  	 */
>>  	page_init_poison(memmap, sizeof(struct page) * PAGES_PER_SECTION);
>>  
>> +	set_section_nid(section_nr, nid);
>>  	section_mark_present(ms);
>>  	sparse_init_one_section(ms, section_nr, memmap, usemap);
>>  
>> 
>
>Although I dislike basically all of the current ->nid design, this seems
>to be the right thing to do
>
>Reviewed-by: David Hildenbrand <david@redhat.com>
>
>-- 
>
>Thanks,
>
>David / dhildenb

-- 
Wei Yang
Help you, Help me


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mm/sparse: set section nid for hot-add memory
  2019-06-17 15:43 ` Oscar Salvador
@ 2019-06-18  0:45   ` Wei Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Wei Yang @ 2019-06-18  0:45 UTC (permalink / raw)
  To: Oscar Salvador; +Cc: Wei Yang, linux-mm, akpm, pasha.tatashin

On Mon, Jun 17, 2019 at 05:43:25PM +0200, Oscar Salvador wrote:
>On Sun, Jun 16, 2019 at 10:35:54AM +0800, Wei Yang wrote:
>> section_to_node_table[] is used to record section's node id, which is
>> used in page_to_nid(). While for hot-add memory, this is missed.
>> 
>> BTW, current online_pages works because it leverages nid in memory_block.
>> But the granularity of node id should be mem_section wide.
>> 
>> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>
>While the patch is valid, I think that the changelog could be improved a bit.
>For example, I would point out the possible problems we can face if it is not set
>properly (e.g: page_to_nid() operations failing to give the right node) and when
>section_to_node_table[] is used (NODE_NOT_IN_PAGE_FLAGS scenario).
>

Thanks, let me give more words on this.

>Reviewed-by: Oscar Salvador <osalvador@suse.de>
>
>> ---
>>  mm/sparse.c | 1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/mm/sparse.c b/mm/sparse.c
>> index fd13166949b5..3ba8f843cb7a 100644
>> --- a/mm/sparse.c
>> +++ b/mm/sparse.c
>> @@ -735,6 +735,7 @@ int __meminit sparse_add_one_section(int nid, unsigned long start_pfn,
>>  	 */
>>  	page_init_poison(memmap, sizeof(struct page) * PAGES_PER_SECTION);
>>  
>> +	set_section_nid(section_nr, nid);
>>  	section_mark_present(ms);
>>  	sparse_init_one_section(ms, section_nr, memmap, usemap);
>>  
>> -- 
>> 2.19.1
>> 
>
>-- 
>Oscar Salvador
>SUSE L3

-- 
Wei Yang
Help you, Help me


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-06-18  0:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-16  2:35 [PATCH] mm/sparse: set section nid for hot-add memory Wei Yang
2019-06-17  4:23 ` Anshuman Khandual
2019-06-17  8:46   ` Wei Yang
2019-06-17 13:13 ` David Hildenbrand
2019-06-18  0:36   ` Wei Yang
2019-06-17 15:43 ` Oscar Salvador
2019-06-18  0:45   ` Wei Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.