From patchwork Fri Nov 16 08:30:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 10685711 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 77DE314E2 for ; Fri, 16 Nov 2018 08:30:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68BFF2D67C for ; Fri, 16 Nov 2018 08:30:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D1F02D690; Fri, 16 Nov 2018 08:30:45 +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 C9B792D67C for ; Fri, 16 Nov 2018 08:30:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 07C126B0882; Fri, 16 Nov 2018 03:30:40 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E5AF96B0883; Fri, 16 Nov 2018 03:30:39 -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 CFDB36B0884; Fri, 16 Nov 2018 03:30:39 -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 75C4D6B0882 for ; Fri, 16 Nov 2018 03:30:39 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id c8-v6so11064847edt.23 for ; Fri, 16 Nov 2018 00:30:39 -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=wSKUKWTu/JnWNKe9NUPf6eNFtrvxLeBHWSYH+NlRpmU=; b=ShqvA9Cz2XeiVBfkYG7Qu222PT2n89Xe/B5z+Zakb2QL14y5+F1q8yboyKSQYbuUxV 9RYpgQYbvQTHWPecMzArh85SP6BSBnMrtFc6PNCkX4nLc9ZzWTXm1GqTCzy0OmQEYnEK m38U9rIp9zSTbQgimpkybsy4XvlC6q0vxz3PKTpT4ndIHzOBMwRCY5j/5Rbd71E2gCQs +fXa870RwIQBpU/Bls2+fg5w/U1F1KxFNksDdqpxA6kg/7uzkuUPLyN/kg2fpgIFbuUb 9wLLh4jhf3er7bOCqCYBCnCQ9XRkMFz/7Ejujb6bclSC7/rDsUzb7bJ07HNUdRT3zrBi l05Q== 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: AGRZ1gIg1CAqZuCov5GZWV3WUpfvSeF43/tQd9Y9uHG5d8/SDIwgS/JU AT323MKyeYIiUXpgB3lTwvanR0nNXjilE7O77xhf6KGrp3cQi+EStuJtvWB5ns85o1JgDVQwvki FjQOYunpMx8YUWOU11Z9Sfjfw+Lr/AIolUf8j6Dvdy7DhuziBTFlOIiwvemORL83HSkupjlBPMy bWRzcuEIZ1J2IGIYvSR0YNetQwHNKbMsGFhOeaJKj4Sgc9Nj00b7YQJYyUEwrghDT83qZxtac0/ mWGiRmRsd0L4xTpxjjPPWcqntzRv09larBWpKNT8RnHDwE/C31QzNbY9qPF6ngt9oYJk0lrja+z d4ABpZ3a5JfrGaNmngsSZdAu3Dj8G44jVihRFRP7AXkK8YP6t1KOHJ2HFmx+A4i5a0noutaDFA= = X-Received: by 2002:a17:906:e211:: with SMTP id gf17-v6mr7835326ejb.46.1542357038956; Fri, 16 Nov 2018 00:30:38 -0800 (PST) X-Received: by 2002:a17:906:e211:: with SMTP id gf17-v6mr7835291ejb.46.1542357037902; Fri, 16 Nov 2018 00:30:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542357037; cv=none; d=google.com; s=arc-20160816; b=uwYQ5E6YBb5ISs1K8QFlfAlOP6hUfdEKC/6uoWnzNwH/vLDMbTvFlSF6DQdDYxI1LV 6jYZt/vsH2xHqSlTflRm35wM3DCuABC5NFgog0DajUI3Bc4N+D+pDeNgGC7GX9U2bW/f VKVMtrnXoWmlRH/Kj4RQJ79dhybX+qgoktp18DXdcXQOrvHBQiEkJh7/EFpBKq8lv3Ts wtVKWxX0suR+r86lB587gSdhE6IFtHtq/iO1x7TiCJjB0UdGpcMsUWIowTHgOK647+TV ecW9UzTOwg1fYx5CMHoQrRpw1o1XylrRHw4b9PUqcrFYxknlIEdXOnK0p+o2aQUXKt7N +m5g== 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=wSKUKWTu/JnWNKe9NUPf6eNFtrvxLeBHWSYH+NlRpmU=; b=C/uG+5jVIV8sc1jgjKt2fgHx14cR0kn4bEgCG98R3F0Ml0pXLRd3y6yUX0zbBCttMv GKVrQB8mxI4TDxDSE+XrlN3OS7x+195WbMIElvxXg9HoQgv+FrzgA8B5c/8vFcANsSFH xUvQ11FVNrUNC6XnTMAluv5cdT0VuLNsom5DN4qogL4b6Rpg+mLGMaXYQO2xWNrJF/A6 jWn/XcYitV1SXVt/g2K9PoVx4mfcWzxE8uiwlmL4UTOCpbh7vu0NzKKaIu6qA+Gs7dDb ZHliZmkuQPRwzYAnKksVUntV2ixz7DXULN1gW67PBb0l1dPVVpJiIPUPF8K9tfzRcMoZ GwLg== 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 n7-v6sor3126134edq.26.2018.11.16.00.30.37 for (Google Transport Security); Fri, 16 Nov 2018 00:30:37 -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: AJdET5c3+G/+V7gFn4TE0EzjkRjzL9V/6jTihahs2hAbkoHDen2rn55TLhiQuPA/cvNpYSXM2K25pg== X-Received: by 2002:a50:8d46:: with SMTP id t6mr8854960edt.269.1542357037478; Fri, 16 Nov 2018 00:30:37 -0800 (PST) Received: from tiehlicka.suse.cz (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id m13sm5305393edd.2.2018.11.16.00.30.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 00:30:36 -0800 (PST) From: Michal Hocko To: Andrew Morton Cc: Oscar Salvador , Baoquan He , Anshuman Khandual , , LKML , Michal Hocko Subject: [PATCH 4/5] mm, memory_hotplug: print reason for the offlining failure Date: Fri, 16 Nov 2018 09:30:19 +0100 Message-Id: <20181116083020.20260-5-mhocko@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181116083020.20260-1-mhocko@kernel.org> References: <20181116083020.20260-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 The memory offlining failure reporting is inconsistent and insufficient. Some error paths simply do not report the failure to the log at all. When we do report there are no details about the reason of the failure and there are several of them which makes memory offlining failures hard to debug. Make sure that the memory offlining [mem %#010llx-%#010llx] failed message is printed for all failures and also provide a short textual reason for the failure e.g. [ 1984.506184] rac1 kernel: memory offlining [mem 0x82600000000-0x8267fffffff] failed due to signal backoff this tells us that the offlining has failed because of a signal pending aka user intervention. [akpm: tweak messages a bit] Signed-off-by: Michal Hocko Reviewed-by: Oscar Salvador Reviewed-by: Anshuman Khandual --- mm/memory_hotplug.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index a92b1b8f6218..88d50e74e3fe 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1553,6 +1553,7 @@ static int __ref __offline_pages(unsigned long start_pfn, unsigned long valid_start, valid_end; struct zone *zone; struct memory_notify arg; + char *reason; mem_hotplug_begin(); @@ -1561,7 +1562,9 @@ static int __ref __offline_pages(unsigned long start_pfn, if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start, &valid_end)) { mem_hotplug_done(); - return -EINVAL; + ret = -EINVAL; + reason = "multizone range"; + goto failed_removal; } zone = page_zone(pfn_to_page(valid_start)); @@ -1573,7 +1576,8 @@ static int __ref __offline_pages(unsigned long start_pfn, MIGRATE_MOVABLE, true); if (ret) { mem_hotplug_done(); - return ret; + reason = "failure to isolate range"; + goto failed_removal; } arg.start_pfn = start_pfn; @@ -1582,15 +1586,19 @@ static int __ref __offline_pages(unsigned long start_pfn, ret = memory_notify(MEM_GOING_OFFLINE, &arg); ret = notifier_to_errno(ret); - if (ret) - goto failed_removal; + if (ret) { + reason = "notifier failure"; + goto failed_removal_isolated; + } pfn = start_pfn; repeat: /* start memory hot removal */ ret = -EINTR; - if (signal_pending(current)) - goto failed_removal; + if (signal_pending(current)) { + reason = "signal backoff"; + goto failed_removal_isolated; + } cond_resched(); lru_add_drain_all(); @@ -1607,8 +1615,10 @@ static int __ref __offline_pages(unsigned long start_pfn, * actually in order to make hugetlbfs's object counting consistent. */ ret = dissolve_free_huge_pages(start_pfn, end_pfn); - if (ret) - goto failed_removal; + if (ret) { + reason = "failure to dissolve huge pages"; + goto failed_removal_isolated; + } /* check again */ offlined_pages = check_pages_isolated(start_pfn, end_pfn); if (offlined_pages < 0) @@ -1648,13 +1658,15 @@ static int __ref __offline_pages(unsigned long start_pfn, mem_hotplug_done(); return 0; +failed_removal_isolated: + undo_isolate_page_range(start_pfn, end_pfn, MIGRATE_MOVABLE); failed_removal: - pr_debug("memory offlining [mem %#010llx-%#010llx] failed\n", + pr_debug("memory offlining [mem %#010llx-%#010llx] failed due to %s\n", (unsigned long long) start_pfn << PAGE_SHIFT, - ((unsigned long long) end_pfn << PAGE_SHIFT) - 1); + ((unsigned long long) end_pfn << PAGE_SHIFT) - 1, + reason); memory_notify(MEM_CANCEL_OFFLINE, &arg); /* pushback to free area */ - undo_isolate_page_range(start_pfn, end_pfn, MIGRATE_MOVABLE); mem_hotplug_done(); return ret; }