* [PATCH] mm, memory_hotplug: __offline_pages fix wrong locking
@ 2019-01-15 12:03 Michal Hocko
2019-01-15 12:03 ` Michal Hocko
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Michal Hocko @ 2019-01-15 12:03 UTC (permalink / raw)
To: Andrew Morton
Cc: Jan Kara, Oscar Salvador, Anshuman Khandual, linux-mm, LKML,
Michal Hocko
From: Michal Hocko <mhocko@suse.com>
Jan has noticed that we do double unlock on some failure paths when
offlining a page range. This is indeed the case when test_pages_in_a_zone
respp. start_isolate_page_range fail. This was an omission when forward
porting the debugging patch from an older kernel.
Fix the issue by dropping mem_hotplug_done from the failure condition
and keeping the single unlock in the catch all failure path.
Reported-by: Jan Kara <jack@suse.cz>
Fixes: 7960509329c2 ("mm, memory_hotplug: print reason for the offlining failure")
Signed-off-by: Michal Hocko <mhocko@suse.com>
---
mm/memory_hotplug.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index b9a667d36c55..faeeaccc5fae 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1576,7 +1576,6 @@ static int __ref __offline_pages(unsigned long start_pfn,
we assume this for now. .*/
if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start,
&valid_end)) {
- mem_hotplug_done();
ret = -EINVAL;
reason = "multizone range";
goto failed_removal;
@@ -1591,7 +1590,6 @@ static int __ref __offline_pages(unsigned long start_pfn,
MIGRATE_MOVABLE,
SKIP_HWPOISON | REPORT_FAILURE);
if (ret) {
- mem_hotplug_done();
reason = "failure to isolate range";
goto failed_removal;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] mm, memory_hotplug: __offline_pages fix wrong locking
2019-01-15 12:03 [PATCH] mm, memory_hotplug: __offline_pages fix wrong locking Michal Hocko
@ 2019-01-15 12:03 ` Michal Hocko
2019-01-15 13:50 ` Oscar Salvador
2019-01-15 17:02 ` Jan Kara
2 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2019-01-15 12:03 UTC (permalink / raw)
To: Andrew Morton
Cc: Jan Kara, Oscar Salvador, Anshuman Khandual, linux-mm, LKML,
Michal Hocko
From: Michal Hocko <mhocko@suse.com>
Jan has noticed that we do double unlock on some failure paths when
offlining a page range. This is indeed the case when test_pages_in_a_zone
respp. start_isolate_page_range fail. This was an omission when forward
porting the debugging patch from an older kernel.
Fix the issue by dropping mem_hotplug_done from the failure condition
and keeping the single unlock in the catch all failure path.
Reported-by: Jan Kara <jack@suse.cz>
Fixes: 7960509329c2 ("mm, memory_hotplug: print reason for the offlining failure")
Signed-off-by: Michal Hocko <mhocko@suse.com>
---
mm/memory_hotplug.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index b9a667d36c55..faeeaccc5fae 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1576,7 +1576,6 @@ static int __ref __offline_pages(unsigned long start_pfn,
we assume this for now. .*/
if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start,
&valid_end)) {
- mem_hotplug_done();
ret = -EINVAL;
reason = "multizone range";
goto failed_removal;
@@ -1591,7 +1590,6 @@ static int __ref __offline_pages(unsigned long start_pfn,
MIGRATE_MOVABLE,
SKIP_HWPOISON | REPORT_FAILURE);
if (ret) {
- mem_hotplug_done();
reason = "failure to isolate range";
goto failed_removal;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm, memory_hotplug: __offline_pages fix wrong locking
2019-01-15 12:03 [PATCH] mm, memory_hotplug: __offline_pages fix wrong locking Michal Hocko
2019-01-15 12:03 ` Michal Hocko
@ 2019-01-15 13:50 ` Oscar Salvador
2019-01-15 17:02 ` Jan Kara
2 siblings, 0 replies; 4+ messages in thread
From: Oscar Salvador @ 2019-01-15 13:50 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, Jan Kara, Oscar Salvador, Anshuman Khandual,
linux-mm, LKML, Michal Hocko
On Tue, Jan 15, 2019 at 01:03:07PM +0100, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
>
> Jan has noticed that we do double unlock on some failure paths when
> offlining a page range. This is indeed the case when test_pages_in_a_zone
> respp. start_isolate_page_range fail. This was an omission when forward
> porting the debugging patch from an older kernel.
>
> Fix the issue by dropping mem_hotplug_done from the failure condition
> and keeping the single unlock in the catch all failure path.
>
> Reported-by: Jan Kara <jack@suse.cz>
> Fixes: 7960509329c2 ("mm, memory_hotplug: print reason for the offlining failure")
> Signed-off-by: Michal Hocko <mhocko@suse.com>
Uhmf, I overlooked that while reviewing the patch.
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Thanks
--
Oscar Salvador
SUSE L3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm, memory_hotplug: __offline_pages fix wrong locking
2019-01-15 12:03 [PATCH] mm, memory_hotplug: __offline_pages fix wrong locking Michal Hocko
2019-01-15 12:03 ` Michal Hocko
2019-01-15 13:50 ` Oscar Salvador
@ 2019-01-15 17:02 ` Jan Kara
2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2019-01-15 17:02 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, Jan Kara, Oscar Salvador, Anshuman Khandual,
linux-mm, LKML, Michal Hocko
On Tue 15-01-19 13:03:07, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
>
> Jan has noticed that we do double unlock on some failure paths when
> offlining a page range. This is indeed the case when test_pages_in_a_zone
> respp. start_isolate_page_range fail. This was an omission when forward
> porting the debugging patch from an older kernel.
>
> Fix the issue by dropping mem_hotplug_done from the failure condition
> and keeping the single unlock in the catch all failure path.
>
> Reported-by: Jan Kara <jack@suse.cz>
> Fixes: 7960509329c2 ("mm, memory_hotplug: print reason for the offlining failure")
> Signed-off-by: Michal Hocko <mhocko@suse.com>
The patch looks good to me so feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Also it fixes the test that previously crashed for me so you can add:
Tested-by: Jan Kara <jack@suse.cz>
Honza
> ---
> mm/memory_hotplug.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index b9a667d36c55..faeeaccc5fae 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1576,7 +1576,6 @@ static int __ref __offline_pages(unsigned long start_pfn,
> we assume this for now. .*/
> if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start,
> &valid_end)) {
> - mem_hotplug_done();
> ret = -EINVAL;
> reason = "multizone range";
> goto failed_removal;
> @@ -1591,7 +1590,6 @@ static int __ref __offline_pages(unsigned long start_pfn,
> MIGRATE_MOVABLE,
> SKIP_HWPOISON | REPORT_FAILURE);
> if (ret) {
> - mem_hotplug_done();
> reason = "failure to isolate range";
> goto failed_removal;
> }
> --
> 2.20.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-01-15 17:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15 12:03 [PATCH] mm, memory_hotplug: __offline_pages fix wrong locking Michal Hocko
2019-01-15 12:03 ` Michal Hocko
2019-01-15 13:50 ` Oscar Salvador
2019-01-15 17:02 ` Jan Kara
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).