Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp715439imu; Tue, 11 Dec 2018 06:30:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/W+JA61ve41QIWMOwwchHJG+VN2zpbP/hfQOhEm/03115KU5P5+ZWmvSIh5wuyfP0uHPo/A X-Received: by 2002:a62:29c3:: with SMTP id p186mr16793348pfp.117.1544538649648; Tue, 11 Dec 2018 06:30:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544538649; cv=none; d=google.com; s=arc-20160816; b=eGq6yhCzDGm8p1xUh9Cr2BuN4badL/YPw2w/AzAspvi//hZ60SYjZos2eyeZP/3WDy Z4IJQivEW2onTfgCrjfCO1H/w0oDV3u9Q6quNwGOTxN7VVY2wT8FR05IJw9saYtBlmG8 omow+JLmMxA889Su3PB8AP82QRbpcEGHEhGdgo17xPrV9ldf3F6c0D00tWEn3RWfXmH/ Z6mJYpfL+kLvBcXGw6Z7qoEKfhfa05l/kPlBz+HaNJC0p74jNbi4KDmP5NXJBXd2harg VaufrLZoANvU6yo70dkOjSEuUFl7T8Hcfti3eAaMooTvoEA3/MFL19o3mVmfzvGWUAGg buZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xXwaJmog1/oEX/6A1+e5tKGx5C0bRqEwCwR2BHwUQq8=; b=g0R/r7xZ7d2QO3IGe3ZKZHANcKV02bgjqt8e7iSX+l5s9lCUobuCUOfZSFiR9hAxka nDkwo70Ue39MaLYVJqMaTg9dzhxyHTR/H1XyfEf1cffqFTJ779ml2hplxDdUL/zlIafh IdToLmi1W6esSfiI5X/byui9s0Xwdl0is3gUry9sD5jLM/ihFxG60dpfQbE6llujn5fB Ko0fmC0YVh0qbhL+d8qvzmcL0+IDH+CkiSpKHq0OZdrBXW3fEjaxn2D1YR7pHZh+ZEKg icBMckl1OlZicRP7SPQVRjC2VbLn/Iu8Kwk5sDmn6yGUDr2z3tUTdjk1h5WwcJSWBZmk JpPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j7si13491051plb.91.2018.12.11.06.30.34; Tue, 11 Dec 2018 06:30:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726833AbeLKO1z (ORCPT + 99 others); Tue, 11 Dec 2018 09:27:55 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:41566 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726241AbeLKO1w (ORCPT ); Tue, 11 Dec 2018 09:27:52 -0500 Received: by mail-ed1-f65.google.com with SMTP id z28so12664312edi.8 for ; Tue, 11 Dec 2018 06:27:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xXwaJmog1/oEX/6A1+e5tKGx5C0bRqEwCwR2BHwUQq8=; b=N8ccPL4uv0pN6Z7hsJ2mcCCMLxUlH10tPTDxeC+oJhi+hPGupzlXEmRhQZGS0PxoSL 6fs9bwp3x4VHVPSv5cTGA5RCbObjYDhEQ98HW2tpn7lsbt5DjVLVS7alnMliidFBUdEk x/+KZRbQ7dVaT158S2XgB38M3DPAx8xQuD/Hp6noKeu18lmG3Uq20996ea3fwwi3vi7E W4tiXjt6MsQay6KrkolTiyTQacQ/C56qKeSPQG0gub9m9Yt6sYyM6tZLdkGjO4h4xe4O qIubck+Ldedf8H/KX80HyUUsP75mpxhefRwhHQn6dA1Uxq7DeLZl984ideQculN8MFcO kzgw== X-Gm-Message-State: AA+aEWb7sTUkg/l+jxIlL1f44iENcmPAGjWyRNOvuJ5ni4+2Zc9zc0ej K3zj/PrarcwKl4fVZ1zQBTs+T1XA X-Received: by 2002:a17:906:7252:: with SMTP id n18-v6mr4309738ejk.192.1544538470766; Tue, 11 Dec 2018 06:27:50 -0800 (PST) Received: from tiehlicka.suse.cz (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id g31sm4073975eda.96.2018.12.11.06.27.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 06:27:50 -0800 (PST) From: Michal Hocko To: Andrew Morton Cc: , LKML , Michal Hocko , David Hildenbrand , Oscar Salvador , Pavel Tatashin Subject: [PATCH 1/3] mm, memory_hotplug: try to migrate full pfn range Date: Tue, 11 Dec 2018 15:27:39 +0100 Message-Id: <20181211142741.2607-2-mhocko@kernel.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181211142741.2607-1-mhocko@kernel.org> References: <20181211142741.2607-1-mhocko@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Hocko do_migrate_range has been limiting the number of pages to migrate to 256 for some reason which is not documented. Even if the limit made some sense back then when it was introduced it doesn't really serve a good purpose these days. If the range contains huge pages then we break out of the loop too early and go through LRU and pcp caches draining and scan_movable_pages is quite suboptimal. The only reason to limit the number of pages I can think of is to reduce the potential time to react on the fatal signal. But even then the number of pages is a questionable metric because even a single page might migration block in a non-killable state (e.g. __unmap_and_move). Remove the limit and offline the full requested range (this is one membblock worth of pages with the current code). Should we ever get a report that offlining takes too long to react on fatal signal then we should rather fix the core migration to use killable waits and bailout on a signal. Reviewed-by: David Hildenbrand Reviewed-by: Pavel Tatashin Reviewed-by: Oscar Salvador Signed-off-by: Michal Hocko --- mm/memory_hotplug.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index c82193db4be6..6263c8cd4491 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1339,18 +1339,16 @@ static struct page *new_node_page(struct page *page, unsigned long private) return new_page_nodemask(page, nid, &nmask); } -#define NR_OFFLINE_AT_ONCE_PAGES (256) static int do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) { unsigned long pfn; struct page *page; - int move_pages = NR_OFFLINE_AT_ONCE_PAGES; int not_managed = 0; int ret = 0; LIST_HEAD(source); - for (pfn = start_pfn; pfn < end_pfn && move_pages > 0; pfn++) { + for (pfn = start_pfn; pfn < end_pfn; pfn++) { if (!pfn_valid(pfn)) continue; page = pfn_to_page(pfn); @@ -1362,8 +1360,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) ret = -EBUSY; break; } - if (isolate_huge_page(page, &source)) - move_pages -= 1 << compound_order(head); + isolate_huge_page(page, &source); continue; } else if (PageTransHuge(page)) pfn = page_to_pfn(compound_head(page)) @@ -1382,7 +1379,6 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) if (!ret) { /* Success */ put_page(page); list_add_tail(&page->lru, &source); - move_pages--; if (!__PageMovable(page)) inc_node_page_state(page, NR_ISOLATED_ANON + page_is_file_cache(page)); -- 2.19.2