BACKPORT: mm/memory_hotplug: fix potential permanent lru cache disable
If offline_pages failed after lru_cache_disable(), it forgot to do lru_cache_enable() in error path. So we would have lru cache disabled permanently in this case. Link: https://lkml.kernel.org/r/20210821094246.10149-3-linmiaohe@huawei.com Fixes: d479960e44f2 ("mm: disable LRU pagevec during the migration temporarily") Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Oscar Salvador <osalvador@suse.de> Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com> Cc: Chris Goldsworthy <cgoldswo@codeaurora.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Minchan Kim <minchan@kernel.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (cherry picked from commit 946746d1ad921e5f493b536533dda02ea22ca609) [connor: move after appropriate label for 5.10] Bug: 187129171 Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: I45e16bfe4812dab86e2e678138599fcaf2b0cd8d
This commit is contained in:

committed by
Connor O'Brien

parent
1d3cff0b48
commit
e44b1adb9e
@@ -1541,7 +1541,7 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages)
|
||||
MEMORY_OFFLINE | REPORT_FAILURE, NULL);
|
||||
if (ret) {
|
||||
reason = "failure to isolate range";
|
||||
goto failed_removal;
|
||||
goto failed_removal_lru_cache_disabled;
|
||||
}
|
||||
|
||||
drain_all_pages(zone);
|
||||
@@ -1656,6 +1656,8 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages)
|
||||
failed_removal_isolated:
|
||||
undo_isolate_page_range(start_pfn, end_pfn, MIGRATE_MOVABLE);
|
||||
memory_notify(MEM_CANCEL_OFFLINE, &arg);
|
||||
failed_removal_lru_cache_disabled:
|
||||
lru_cache_enable();
|
||||
failed_removal:
|
||||
pr_debug("memory offlining [mem %#010llx-%#010llx] failed due to %s\n",
|
||||
(unsigned long long) start_pfn << PAGE_SHIFT,
|
||||
|
Reference in New Issue
Block a user