* [PATCH] mm/sparse: use __nr_to_section(section_nr) to get mem_section
@ 2019-08-09 1:02 Wei Yang
2019-08-09 9:09 ` Anshuman Khandual
0 siblings, 1 reply; 3+ messages in thread
From: Wei Yang @ 2019-08-09 1:02 UTC (permalink / raw)
To: akpm, osalvador, pasha.tatashin, mhocko; +Cc: linux-mm, linux-kernel, Wei Yang
__pfn_to_section is defined as __nr_to_section(pfn_to_section_nr(pfn)).
Since we already get section_nr, it is not necessary to get mem_section
from start_pfn. By doing so, we reduce one redundant operation.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
mm/sparse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/sparse.c b/mm/sparse.c
index 72f010d9bff5..95158a148cd1 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -867,7 +867,7 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn,
*/
page_init_poison(pfn_to_page(start_pfn), sizeof(struct page) * nr_pages);
- ms = __pfn_to_section(start_pfn);
+ ms = __nr_to_section(section_nr);
set_section_nid(section_nr, nid);
section_mark_present(ms);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/sparse: use __nr_to_section(section_nr) to get mem_section
2019-08-09 1:02 [PATCH] mm/sparse: use __nr_to_section(section_nr) to get mem_section Wei Yang
@ 2019-08-09 9:09 ` Anshuman Khandual
2019-08-09 13:46 ` Wei Yang
0 siblings, 1 reply; 3+ messages in thread
From: Anshuman Khandual @ 2019-08-09 9:09 UTC (permalink / raw)
To: Wei Yang, akpm, osalvador, pasha.tatashin, mhocko; +Cc: linux-mm, linux-kernel
On 08/09/2019 06:32 AM, Wei Yang wrote:
> __pfn_to_section is defined as __nr_to_section(pfn_to_section_nr(pfn)).
Right.
>
> Since we already get section_nr, it is not necessary to get mem_section
> from start_pfn. By doing so, we reduce one redundant operation.
>
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Looks right.
With this applied, memory hot add still works on arm64.
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> mm/sparse.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 72f010d9bff5..95158a148cd1 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -867,7 +867,7 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn,
> */
> page_init_poison(pfn_to_page(start_pfn), sizeof(struct page) * nr_pages);
>
> - ms = __pfn_to_section(start_pfn);
> + ms = __nr_to_section(section_nr);
> set_section_nid(section_nr, nid);
> section_mark_present(ms);
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/sparse: use __nr_to_section(section_nr) to get mem_section
2019-08-09 9:09 ` Anshuman Khandual
@ 2019-08-09 13:46 ` Wei Yang
0 siblings, 0 replies; 3+ messages in thread
From: Wei Yang @ 2019-08-09 13:46 UTC (permalink / raw)
To: Anshuman Khandual
Cc: Wei Yang, akpm, osalvador, pasha.tatashin, mhocko, linux-mm,
linux-kernel
On Fri, Aug 09, 2019 at 02:39:59PM +0530, Anshuman Khandual wrote:
>
>
>On 08/09/2019 06:32 AM, Wei Yang wrote:
>> __pfn_to_section is defined as __nr_to_section(pfn_to_section_nr(pfn)).
>
>Right.
>
>>
>> Since we already get section_nr, it is not necessary to get mem_section
>> from start_pfn. By doing so, we reduce one redundant operation.
>>
>> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>
>Looks right.
>
>With this applied, memory hot add still works on arm64.
Thanks for your test.
>
>Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
>
>> ---
>> mm/sparse.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/sparse.c b/mm/sparse.c
>> index 72f010d9bff5..95158a148cd1 100644
>> --- a/mm/sparse.c
>> +++ b/mm/sparse.c
>> @@ -867,7 +867,7 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn,
>> */
>> page_init_poison(pfn_to_page(start_pfn), sizeof(struct page) * nr_pages);
>>
>> - ms = __pfn_to_section(start_pfn);
>> + ms = __nr_to_section(section_nr);
>> set_section_nid(section_nr, nid);
>> section_mark_present(ms);
>>
>>
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-09 13:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-09 1:02 [PATCH] mm/sparse: use __nr_to_section(section_nr) to get mem_section Wei Yang
2019-08-09 9:09 ` Anshuman Khandual
2019-08-09 13:46 ` Wei Yang
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).