[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190829070019.12714-8-david@redhat.com>
Date: Thu, 29 Aug 2019 09:00:15 +0200
From: David Hildenbrand <david@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: linux-mm@...ck.org, David Hildenbrand <david@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Oscar Salvador <osalvador@...e.de>,
Michal Hocko <mhocko@...e.com>,
Pavel Tatashin <pasha.tatashin@...een.com>,
Dan Williams <dan.j.williams@...el.com>,
Wei Yang <richardw.yang@...ux.intel.com>
Subject: [PATCH v3 07/11] mm/memory_hotplug: Exit early in __remove_pages() on BUGs
The error path should never happen in practice (unless bringing up a new
device driver, or on BUGs). However, it's clearer to not touch anything
in case we are going to return right away. Move the check/return.
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Oscar Salvador <osalvador@...e.de>
Cc: Michal Hocko <mhocko@...e.com>
Cc: David Hildenbrand <david@...hat.com>
Cc: Pavel Tatashin <pasha.tatashin@...een.com>
Cc: Dan Williams <dan.j.williams@...el.com>
Cc: Wei Yang <richardw.yang@...ux.intel.com>
Signed-off-by: David Hildenbrand <david@...hat.com>
---
mm/memory_hotplug.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 65b3fdf7f838..56eabd22cbae 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -527,13 +527,13 @@ void __remove_pages(struct zone *zone, unsigned long pfn,
unsigned long map_offset = 0;
unsigned long nr, start_sec, end_sec;
+ if (check_pfn_span(pfn, nr_pages, "remove"))
+ return;
+
map_offset = vmem_altmap_offset(altmap);
clear_zone_contiguous(zone);
- if (check_pfn_span(pfn, nr_pages, "remove"))
- return;
-
start_sec = pfn_to_section_nr(pfn);
end_sec = pfn_to_section_nr(pfn + nr_pages - 1);
for (nr = start_sec; nr <= end_sec; nr++) {
--
2.21.0
Powered by blists - more mailing lists