All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: sections are not offlined during memory hotremove
@ 2018-04-26 15:58 Pavel Tatashin
  2018-04-26 19:11 ` Michal Hocko
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Tatashin @ 2018-04-26 15:58 UTC (permalink / raw)
  To: steven.sistare, daniel.m.jordan, akpm, kirill.shutemov,
	linux-kernel, mhocko, linux-mm

Memory hotplug, and hotremove operate with per-block granularity. If
machine has large amount of memory (more than 64G), the size of memory
block can span multiple sections. By mistake, during hotremove we set
only the first section to offline state.

The bug was discovered because kernel selftest started to fail:
https://lkml.kernel.org/r/20180423011247.GK5563@yexl-desktop

After commit, "mm/memory_hotplug: optimize probe routine". But, the bug is
older than this commit. In this optimization we also added a check for
sections to be in a proper state during hotplug operation.

Fixes: 2d070eab2e82 ("mm: consider zone which is not fully populated to have holes")

Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
---
 mm/sparse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 62eef264a7bd..73dc2fcc0eab 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -629,7 +629,7 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn)
 	unsigned long pfn;
 
 	for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
-		unsigned long section_nr = pfn_to_section_nr(start_pfn);
+		unsigned long section_nr = pfn_to_section_nr(pfn);
 		struct mem_section *ms;
 
 		/*
-- 
1.8.3.1

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

* Re: [PATCH] mm: sections are not offlined during memory hotremove
  2018-04-26 15:58 [PATCH] mm: sections are not offlined during memory hotremove Pavel Tatashin
@ 2018-04-26 19:11 ` Michal Hocko
  2018-04-26 19:11   ` Michal Hocko
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Hocko @ 2018-04-26 19:11 UTC (permalink / raw)
  To: Pavel Tatashin
  Cc: steven.sistare, daniel.m.jordan, akpm, kirill.shutemov,
	linux-kernel, linux-mm

On Thu 26-04-18 11:58:34, Pavel Tatashin wrote:
> Memory hotplug, and hotremove operate with per-block granularity. If
> machine has large amount of memory (more than 64G), the size of memory
> block can span multiple sections. By mistake, during hotremove we set
> only the first section to offline state.
> 
> The bug was discovered because kernel selftest started to fail:
> https://lkml.kernel.org/r/20180423011247.GK5563@yexl-desktop
> 
> After commit, "mm/memory_hotplug: optimize probe routine". But, the bug is
> older than this commit. In this optimization we also added a check for
> sections to be in a proper state during hotplug operation.
> 
> Fixes: 2d070eab2e82 ("mm: consider zone which is not fully populated to have holes")

Dohh. When I saw this I've had that feeling that I have fixed this
already and it must have get lost somewhere. But no, this was the same
bug in a different path b4ccec41af82 ("mm/sparse.c: fix typo in
online_mem_sections"). I wonder why I haven't noticed the same pattern
in the offline path.

Thanks for noticing and fixing this.

> Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  mm/sparse.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 62eef264a7bd..73dc2fcc0eab 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -629,7 +629,7 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn)
>  	unsigned long pfn;
>  
>  	for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
> -		unsigned long section_nr = pfn_to_section_nr(start_pfn);
> +		unsigned long section_nr = pfn_to_section_nr(pfn);
>  		struct mem_section *ms;
>  
>  		/*
> -- 
> 1.8.3.1
> 

-- 
Michal Hocko
SUSE Labs

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

* Re: [PATCH] mm: sections are not offlined during memory hotremove
  2018-04-26 19:11 ` Michal Hocko
@ 2018-04-26 19:11   ` Michal Hocko
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Hocko @ 2018-04-26 19:11 UTC (permalink / raw)
  To: Pavel Tatashin
  Cc: steven.sistare, daniel.m.jordan, akpm, kirill.shutemov,
	linux-kernel, linux-mm

On Thu 26-04-18 21:11:11, Michal Hocko wrote:
> On Thu 26-04-18 11:58:34, Pavel Tatashin wrote:
> > Memory hotplug, and hotremove operate with per-block granularity. If
> > machine has large amount of memory (more than 64G), the size of memory
> > block can span multiple sections. By mistake, during hotremove we set
> > only the first section to offline state.
> > 
> > The bug was discovered because kernel selftest started to fail:
> > https://lkml.kernel.org/r/20180423011247.GK5563@yexl-desktop
> > 
> > After commit, "mm/memory_hotplug: optimize probe routine". But, the bug is
> > older than this commit. In this optimization we also added a check for
> > sections to be in a proper state during hotplug operation.
> > 
> > Fixes: 2d070eab2e82 ("mm: consider zone which is not fully populated to have holes")
> 
> Dohh. When I saw this I've had that feeling that I have fixed this
> already and it must have get lost somewhere. But no, this was the same
> bug in a different path b4ccec41af82 ("mm/sparse.c: fix typo in
> online_mem_sections"). I wonder why I haven't noticed the same pattern
> in the offline path.
> 
> Thanks for noticing and fixing this.
> 
> > Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
> 
> Acked-by: Michal Hocko <mhocko@suse.com>

Btw. Cc: stable would be appropriate.

> 
> >  mm/sparse.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/mm/sparse.c b/mm/sparse.c
> > index 62eef264a7bd..73dc2fcc0eab 100644
> > --- a/mm/sparse.c
> > +++ b/mm/sparse.c
> > @@ -629,7 +629,7 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn)
> >  	unsigned long pfn;
> >  
> >  	for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
> > -		unsigned long section_nr = pfn_to_section_nr(start_pfn);
> > +		unsigned long section_nr = pfn_to_section_nr(pfn);
> >  		struct mem_section *ms;
> >  
> >  		/*
> > -- 
> > 1.8.3.1
> > 
> 
> -- 
> Michal Hocko
> SUSE Labs

-- 
Michal Hocko
SUSE Labs

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

* Re: [PATCH] mm: sections are not offlined during memory hotremove
  2018-04-26 20:30 Pavel Tatashin
@ 2018-04-27  7:08 ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2018-04-27  7:08 UTC (permalink / raw)
  To: Pavel Tatashin
  Cc: steven.sistare, daniel.m.jordan, akpm, kirill.shutemov,
	linux-kernel, mhocko, linux-mm, stable

On Thu, Apr 26, 2018 at 04:30:02PM -0400, Pavel Tatashin wrote:
> Memory hotplug, and hotremove operate with per-block granularity. If
> machine has large amount of memory (more than 64G), the size of memory
> block can span multiple sections. By mistake, during hotremove we set
> only the first section to offline state.
> 
> The bug was discovered because kernel selftest started to fail:
> https://lkml.kernel.org/r/20180423011247.GK5563@yexl-desktop
> 
> After commit, "mm/memory_hotplug: optimize probe routine". But, the bug is
> older than this commit. In this optimization we also added a check for
> sections to be in a proper state during hotplug operation.
> 
> Fixes: 2d070eab2e82 ("mm: consider zone which is not fully populated to have holes")
> 
> Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
> Acked-by: Michal Hocko <mhocko@suse.com>
> ---
>  mm/sparse.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 62eef264a7bd..73dc2fcc0eab 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -629,7 +629,7 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn)
>  	unsigned long pfn;
>  
>  	for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
> -		unsigned long section_nr = pfn_to_section_nr(start_pfn);
> +		unsigned long section_nr = pfn_to_section_nr(pfn);
>  		struct mem_section *ms;
>  
>  		/*
> -- 
> 2.17.0

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

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

* [PATCH] mm: sections are not offlined during memory hotremove
@ 2018-04-26 20:30 Pavel Tatashin
  2018-04-27  7:08 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Tatashin @ 2018-04-26 20:30 UTC (permalink / raw)
  To: steven.sistare, daniel.m.jordan, akpm, kirill.shutemov,
	linux-kernel, mhocko, linux-mm, stable

Memory hotplug, and hotremove operate with per-block granularity. If
machine has large amount of memory (more than 64G), the size of memory
block can span multiple sections. By mistake, during hotremove we set
only the first section to offline state.

The bug was discovered because kernel selftest started to fail:
https://lkml.kernel.org/r/20180423011247.GK5563@yexl-desktop

After commit, "mm/memory_hotplug: optimize probe routine". But, the bug is
older than this commit. In this optimization we also added a check for
sections to be in a proper state during hotplug operation.

Fixes: 2d070eab2e82 ("mm: consider zone which is not fully populated to have holes")

Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Acked-by: Michal Hocko <mhocko@suse.com>
---
 mm/sparse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 62eef264a7bd..73dc2fcc0eab 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -629,7 +629,7 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn)
 	unsigned long pfn;
 
 	for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
-		unsigned long section_nr = pfn_to_section_nr(start_pfn);
+		unsigned long section_nr = pfn_to_section_nr(pfn);
 		struct mem_section *ms;
 
 		/*
-- 
2.17.0

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

end of thread, other threads:[~2018-04-27  7:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-26 15:58 [PATCH] mm: sections are not offlined during memory hotremove Pavel Tatashin
2018-04-26 19:11 ` Michal Hocko
2018-04-26 19:11   ` Michal Hocko
2018-04-26 20:30 Pavel Tatashin
2018-04-27  7:08 ` Greg KH

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.