linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm, memory_hotplug: fix devm_memremap_pages() after memory_hotplug rework
@ 2017-04-04 16:51 Jérôme Glisse
  2017-04-04 16:57 ` Michal Hocko
  2017-04-05 10:35 ` Anshuman Khandual
  0 siblings, 2 replies; 6+ messages in thread
From: Jérôme Glisse @ 2017-04-04 16:51 UTC (permalink / raw)
  To: linux-mm; +Cc: Jérôme Glisse, Michal Hocko, Dan Williams

Just a trivial fix.

Signed-off-by: JA(C)rA'me Glisse <jglisse@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Dan Williams <dan.j.williams@intel.com>
---
 kernel/memremap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/memremap.c b/kernel/memremap.c
index faa9276..bbbe646 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -366,7 +366,8 @@ void *devm_memremap_pages(struct device *dev, struct resource *res,
 	error = arch_add_memory(nid, align_start, align_size);
 	if (!error)
 		move_pfn_range_to_zone(&NODE_DATA(nid)->node_zones[ZONE_DEVICE],
-				align_start, align_size);
+					align_start >> PAGE_SHIFT,
+					align_size >> PAGE_SHIFT);
 	mem_hotplug_done();
 	if (error)
 		goto err_add_memory;
-- 
2.9.3

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

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

* Re: [PATCH] mm, memory_hotplug: fix devm_memremap_pages() after memory_hotplug rework
  2017-04-04 16:51 [PATCH] mm, memory_hotplug: fix devm_memremap_pages() after memory_hotplug rework Jérôme Glisse
@ 2017-04-04 16:57 ` Michal Hocko
  2017-04-05 10:35 ` Anshuman Khandual
  1 sibling, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2017-04-04 16:57 UTC (permalink / raw)
  To: Jérôme Glisse; +Cc: linux-mm, Dan Williams

On Tue 04-04-17 12:51:44, Jerome Glisse wrote:
> Just a trivial fix.
> 
> Signed-off-by: Jerome Glisse <jglisse@redhat.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Dan Williams <dan.j.williams@intel.com>

Thanks for catching this! I will fold this into the patch.

> ---
>  kernel/memremap.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/memremap.c b/kernel/memremap.c
> index faa9276..bbbe646 100644
> --- a/kernel/memremap.c
> +++ b/kernel/memremap.c
> @@ -366,7 +366,8 @@ void *devm_memremap_pages(struct device *dev, struct resource *res,
>  	error = arch_add_memory(nid, align_start, align_size);
>  	if (!error)
>  		move_pfn_range_to_zone(&NODE_DATA(nid)->node_zones[ZONE_DEVICE],
> -				align_start, align_size);
> +					align_start >> PAGE_SHIFT,
> +					align_size >> PAGE_SHIFT);
>  	mem_hotplug_done();
>  	if (error)
>  		goto err_add_memory;
> -- 
> 2.9.3
> 

-- 
Michal Hocko
SUSE Labs

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

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

* Re: [PATCH] mm, memory_hotplug: fix devm_memremap_pages() after memory_hotplug rework
  2017-04-04 16:51 [PATCH] mm, memory_hotplug: fix devm_memremap_pages() after memory_hotplug rework Jérôme Glisse
  2017-04-04 16:57 ` Michal Hocko
@ 2017-04-05 10:35 ` Anshuman Khandual
  2017-04-05 10:49   ` Michal Hocko
  1 sibling, 1 reply; 6+ messages in thread
From: Anshuman Khandual @ 2017-04-05 10:35 UTC (permalink / raw)
  To: Jérôme Glisse, linux-mm; +Cc: Michal Hocko, Dan Williams

On 04/04/2017 10:21 PM, JA(C)rA'me Glisse wrote:
> Just a trivial fix.
> 
> Signed-off-by: JA(C)rA'me Glisse <jglisse@redhat.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> ---
>  kernel/memremap.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/memremap.c b/kernel/memremap.c
> index faa9276..bbbe646 100644
> --- a/kernel/memremap.c
> +++ b/kernel/memremap.c
> @@ -366,7 +366,8 @@ void *devm_memremap_pages(struct device *dev, struct resource *res,
>  	error = arch_add_memory(nid, align_start, align_size);
>  	if (!error)
>  		move_pfn_range_to_zone(&NODE_DATA(nid)->node_zones[ZONE_DEVICE],
> -				align_start, align_size);
> +					align_start >> PAGE_SHIFT,
> +					align_size >> PAGE_SHIFT);

All this while it was taking up addresses instead of PFNs ? Then
how it was working correctly before ?

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

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

* Re: [PATCH] mm, memory_hotplug: fix devm_memremap_pages() after memory_hotplug rework
  2017-04-05 10:35 ` Anshuman Khandual
@ 2017-04-05 10:49   ` Michal Hocko
  2017-04-06  5:34     ` Anshuman Khandual
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Hocko @ 2017-04-05 10:49 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: Jérôme Glisse, linux-mm, Dan Williams

On Wed 05-04-17 16:05:23, Anshuman Khandual wrote:
> On 04/04/2017 10:21 PM, Jerome Glisse wrote:
> > Just a trivial fix.
> > 
> > Signed-off-by: Jerome Glisse <jglisse@redhat.com>
> > Cc: Michal Hocko <mhocko@suse.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > ---
> >  kernel/memremap.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/kernel/memremap.c b/kernel/memremap.c
> > index faa9276..bbbe646 100644
> > --- a/kernel/memremap.c
> > +++ b/kernel/memremap.c
> > @@ -366,7 +366,8 @@ void *devm_memremap_pages(struct device *dev, struct resource *res,
> >  	error = arch_add_memory(nid, align_start, align_size);
> >  	if (!error)
> >  		move_pfn_range_to_zone(&NODE_DATA(nid)->node_zones[ZONE_DEVICE],
> > -				align_start, align_size);
> > +					align_start >> PAGE_SHIFT,
> > +					align_size >> PAGE_SHIFT);
> 
> All this while it was taking up addresses instead of PFNs ? Then
> how it was working correctly before ?

Because this code was embeded inside the arch_add_memory which did the
translation properly. See arch_add_memory implementations.
 

-- 
Michal Hocko
SUSE Labs

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

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

* Re: [PATCH] mm, memory_hotplug: fix devm_memremap_pages() after memory_hotplug rework
  2017-04-05 10:49   ` Michal Hocko
@ 2017-04-06  5:34     ` Anshuman Khandual
  2017-04-06  6:41       ` Michal Hocko
  0 siblings, 1 reply; 6+ messages in thread
From: Anshuman Khandual @ 2017-04-06  5:34 UTC (permalink / raw)
  To: Michal Hocko, Anshuman Khandual
  Cc: Jérôme Glisse, linux-mm, Dan Williams

On 04/05/2017 04:19 PM, Michal Hocko wrote:
> On Wed 05-04-17 16:05:23, Anshuman Khandual wrote:
>> On 04/04/2017 10:21 PM, Jerome Glisse wrote:
>>> Just a trivial fix.
>>>
>>> Signed-off-by: Jerome Glisse <jglisse@redhat.com>
>>> Cc: Michal Hocko <mhocko@suse.com>
>>> Cc: Dan Williams <dan.j.williams@intel.com>
>>> ---
>>>  kernel/memremap.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/kernel/memremap.c b/kernel/memremap.c
>>> index faa9276..bbbe646 100644
>>> --- a/kernel/memremap.c
>>> +++ b/kernel/memremap.c
>>> @@ -366,7 +366,8 @@ void *devm_memremap_pages(struct device *dev, struct resource *res,
>>>  	error = arch_add_memory(nid, align_start, align_size);
>>>  	if (!error)
>>>  		move_pfn_range_to_zone(&NODE_DATA(nid)->node_zones[ZONE_DEVICE],
>>> -				align_start, align_size);
>>> +					align_start >> PAGE_SHIFT,
>>> +					align_size >> PAGE_SHIFT);
>>
>> All this while it was taking up addresses instead of PFNs ? Then
>> how it was working correctly before ?
> 
> Because this code was embeded inside the arch_add_memory which did the
> translation properly. See arch_add_memory implementations.

Got your point. Checked both mainline kernel and mmotm branch
v4.11-rc5-mmotm-2017-04-04-15-00, in both the places the code
snippet seems to be different than here. For example arch_add
_memory has the following signature instead.

arch_add_memory(nid, align_start, align_size, true);

and I dont see move_pfn_range_to_zone() at all. Which tree/
branch this patch is against ?



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

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

* Re: [PATCH] mm, memory_hotplug: fix devm_memremap_pages() after memory_hotplug rework
  2017-04-06  5:34     ` Anshuman Khandual
@ 2017-04-06  6:41       ` Michal Hocko
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2017-04-06  6:41 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: Jérôme Glisse, linux-mm, Dan Williams

On Thu 06-04-17 11:04:20, Anshuman Khandual wrote:
> On 04/05/2017 04:19 PM, Michal Hocko wrote:
> > On Wed 05-04-17 16:05:23, Anshuman Khandual wrote:
> >> On 04/04/2017 10:21 PM, Jerome Glisse wrote:
> >>> Just a trivial fix.
> >>>
> >>> Signed-off-by: Jerome Glisse <jglisse@redhat.com>
> >>> Cc: Michal Hocko <mhocko@suse.com>
> >>> Cc: Dan Williams <dan.j.williams@intel.com>
> >>> ---
> >>>  kernel/memremap.c | 3 ++-
> >>>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/kernel/memremap.c b/kernel/memremap.c
> >>> index faa9276..bbbe646 100644
> >>> --- a/kernel/memremap.c
> >>> +++ b/kernel/memremap.c
> >>> @@ -366,7 +366,8 @@ void *devm_memremap_pages(struct device *dev, struct resource *res,
> >>>  	error = arch_add_memory(nid, align_start, align_size);
> >>>  	if (!error)
> >>>  		move_pfn_range_to_zone(&NODE_DATA(nid)->node_zones[ZONE_DEVICE],
> >>> -				align_start, align_size);
> >>> +					align_start >> PAGE_SHIFT,
> >>> +					align_size >> PAGE_SHIFT);
> >>
> >> All this while it was taking up addresses instead of PFNs ? Then
> >> how it was working correctly before ?
> > 
> > Because this code was embeded inside the arch_add_memory which did the
> > translation properly. See arch_add_memory implementations.
> 
> Got your point. Checked both mainline kernel and mmotm branch
> v4.11-rc5-mmotm-2017-04-04-15-00, in both the places the code
> snippet seems to be different than here. For example arch_add
> _memory has the following signature instead.
> 
> arch_add_memory(nid, align_start, align_size, true);
> 
> and I dont see move_pfn_range_to_zone() at all. Which tree/
> branch this patch is against ?

See http://lkml.kernel.org/r/20170330115454.32154-1-mhocko@kernel.org
this is a follow up fix for patch 5
-- 
Michal Hocko
SUSE Labs

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

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

end of thread, other threads:[~2017-04-06  6:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 16:51 [PATCH] mm, memory_hotplug: fix devm_memremap_pages() after memory_hotplug rework Jérôme Glisse
2017-04-04 16:57 ` Michal Hocko
2017-04-05 10:35 ` Anshuman Khandual
2017-04-05 10:49   ` Michal Hocko
2017-04-06  5:34     ` Anshuman Khandual
2017-04-06  6:41       ` Michal Hocko

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