From patchwork Tue Dec 11 14:27:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 10723895 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30E3391E for ; Tue, 11 Dec 2018 14:27:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20BCE28587 for ; Tue, 11 Dec 2018 14:27:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 134CB2883D; Tue, 11 Dec 2018 14:27:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 951CA28587 for ; Tue, 11 Dec 2018 14:27:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4BD1F8E0090; Tue, 11 Dec 2018 09:27:53 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3A0B08E004D; Tue, 11 Dec 2018 09:27:53 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 291028E0090; Tue, 11 Dec 2018 09:27:53 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id C36FF8E004D for ; Tue, 11 Dec 2018 09:27:52 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id d41so6860422eda.12 for ; Tue, 11 Dec 2018 06:27:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results: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=G+w7zFFCQU63kBRSZGmx5YiN/ZzQmNs0kR5rCtUIjA7MQJKRfcfAM+82pL4LQHzXN2 UBblzuxyeUI5AfXhLOqeTDU8wVRVa9G6Dv/BIia+dKdESV0QdVN40UfMnRtAj80SfEfi 3Nhanzfy+lJKLd38Xhstu0qUm6GRu65w/7RuteLjgvXF6/uCnFXmOTsiiqYumD64Nowj h+s67UtYd3f6bGB8dLyMLp5xrWU123Zbwknw8nSvkjkM1eULDA9rEqMolMmwh59ATmZc pK7exMb4zApESp7XEOVv3kBogIKETUt0aWgCc/4akCcBuIV+g2PHAGG55vSTDtsoO2+E vW5g== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=mstsxfx@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Gm-Message-State: AA+aEWYCqZKZTvwwaJhrqv4NKSUpP+EthIuE7iF9HDl9IexK+sOOsvM6 9qiFJm8Dn2lgqf8/mlDt4pM1R0Pub1N4+gPM4qNUpIiGU57Dvjz8IygSxVzWDAxSGuDW/0n9OvT EFVRrtSjnXGjdrJk/xJ04rtaoKkjRN3zavXFu7UrUJa5VumqSzkqwPWc6op6PhWyWHiSos4ENaR h87g7B9BhY5+XufdVpUDwRXEBpY04pN9LebZCR5IORSBz+vpYlHXZXVTxLuzO+/o8446yQLYXkW zvos1CqoqCoUhrAvrwbZcTYSNAPrve0eqaBM3bXvt5VNlMr+OAyskJmX6t68D1THDIKvaob4Cet ySSHlxgLBwYH7UgvFhMp10cTYmAzc1Oi8lyrzL1kpoLATQOcI1KV9BbH1UI/WA2HNSEsEiuRRg= = X-Received: by 2002:a17:906:7a4e:: with SMTP id i14-v6mr12652401ejo.16.1544538472303; Tue, 11 Dec 2018 06:27:52 -0800 (PST) X-Received: by 2002:a17:906:7a4e:: with SMTP id i14-v6mr12652355ejo.16.1544538471165; Tue, 11 Dec 2018 06:27:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544538471; cv=none; d=google.com; s=arc-20160816; b=o3PJUL2LwCHleVbax/oEsBSy5aJsz0r7mxz8qqj5P10/ovZOYx5g67smXEsZqDZR+A 4x8DWTB2GQEDr8ZhWzpsM9BeruUvU3PidsYAHA9Lt9UQRmadCINpHjej2rnLyIsogoMX tYHlwIVK5+YZgRK3fgLOmVffNtjtBg2edJBm5OllaTSbuAefmzNHt2lVKOaWNSvUhc5w oCUAVsWVRY6X3o/navF5pRhG49nRMh5D0XGSEBe/R/j1jdjtaZn0UXj6gfC3bX2BLb3I QdLIXlQL7hKb508v8U7nMjWzFWKkGK8MlJehWMTffduLgGYWhoGjhFoAhFW6866xM6VO Il2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=xXwaJmog1/oEX/6A1+e5tKGx5C0bRqEwCwR2BHwUQq8=; b=rtiC2ykV9nRknHs7Fz4M9EpiX5yNQcIgtcUx7GW4XlVp0ehbVsW/HVb8wFRFfK2da/ NSJ1vwDjrZymtYdmsFo09F1NdPuVSN8Z6jRx+3Qr+fDAhadHBfArCDID45RGu0zmZGzJ hSILnXKZWb5lHDXpKJ1hVcRLjd4PZKag2ZSoJsxE+iWXyECp4SKJuFCRFcnDh2SvULHf 0HldwAeF+DLCYdffcNDziOZFDlsP2zDmdJf/fvKV2npddLmX+hpyopVRK8Z1ez3zR1hF 11KTyWC3L8jawGRGzvEGLqxvdx8Nrhkr2jc9eQrwJ9GIx8jVP9aSlgh91j0FTu+yWRxI JQtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=mstsxfx@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id s23-v6sor3747414eju.43.2018.12.11.06.27.51 for (Google Transport Security); Tue, 11 Dec 2018 06:27:51 -0800 (PST) Received-SPF: pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=mstsxfx@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Google-Smtp-Source: AFSGD/WU5eBB4mLDzkmMW5SXZsrmL9erDeMhxzG1pm5Jdw/nZ0jvoqQoYpuRcJhGY3RoLQMZAwf91Q== 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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));