Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp10259826ybl; Thu, 26 Dec 2019 14:04:23 -0800 (PST) X-Google-Smtp-Source: APXvYqzW6YqHq5HVhYzLQJefgaj0deH4zIgmYnICUiwgSRqOBOC/PsMf27EY/mZoq7F7WokMTPRi X-Received: by 2002:aca:3cd7:: with SMTP id j206mr3172377oia.142.1577397863825; Thu, 26 Dec 2019 14:04:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577397863; cv=none; d=google.com; s=arc-20160816; b=trkP+oZpbyzSoh6IQbd4c81lvyLiImc6g6NhoWfpShZCXc0rXciY1FxcSo3iETXcKi pO2VBREtJfz7y7Ij1DPvvfEP45c0vG+VbG7jFG6YoZRga2CY+OFK0qhAKCMbJyViM1ua qLlupPN6jyKflrB15LLkivkQLbo8WSfzaJ5N4o3gsqRpIC2vr5Dq1dHe16vdgEuuSOYC W7CYgMDkTESxar2tKZBQFlFp5J/CDiSV6KHXlLODG+OSrazAMOJFWgJeaaNbkaQouV3n jB/RWhhZSTY6KrirLNr4CwD/QKg/J2KGdXKj+NLtgL1XF4deUDKzg7bg9FE84JLi90FV 7c+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=IWftFaF/7pwaE+hKN0rmHHTDccHnFs4MwoJXhQKr9TA=; b=VDCbJAGK8Z+97bImIm11OAH0wkXF4A5n7X4hlHa75KM+7ql6gWGx2fIHPKt+oWIosJ 2Z0/2c9v4+rRdBupmYCdQA2dZLwIMauKm4ZWyALoEXkmOBOAcDAeKo1Vdm3xPeIqE9wL 2c+RJyTZQUprZrBv0yTTcBpv82UYG56qUpQXacG1H80FJW9ixuGOEG3nPrbicmMFjxVW 0fl5+vfsUIJSaXJ+SH5Vr84OmEU812GHXvZV8cGo2kPB+ZEiDtDHVLuD7oi2d9NmAxjm K0W/r7qOITDRiJ9oPpOv+iplN/hdj9ApXKto6LGQmLxBP5OLWE/iNUndzAp8UiKxHlAn 5z0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gkZdvYRI; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i78si15570475oib.1.2019.12.26.14.04.12; Thu, 26 Dec 2019 14:04:23 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=gkZdvYRI; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727030AbfLZWC2 (ORCPT + 99 others); Thu, 26 Dec 2019 17:02:28 -0500 Received: from mail-pf1-f201.google.com ([209.85.210.201]:38199 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726277AbfLZWC2 (ORCPT ); Thu, 26 Dec 2019 17:02:28 -0500 Received: by mail-pf1-f201.google.com with SMTP id l17so7078911pff.5 for ; Thu, 26 Dec 2019 14:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=IWftFaF/7pwaE+hKN0rmHHTDccHnFs4MwoJXhQKr9TA=; b=gkZdvYRIM6t/k5mvuiOx0NjfLs8crDbn+2OtfVQzXTnkf6e+nNttco+jq6a/qP5oON /y0+M3BAAzcRXG2LZrJNaLyKa4mG/9AELtjd4dIFKjBPJHtyGADgLZ1sr00z1SdXGSgG JbGc/Jq+Ka2wgAakUhGMqkpJWt0kpwqLiKmdvBoRlS8FKqN9nifvr/tgH4f91BcZX7iE ay1h92vcYGzo1FrWidKKBNdVSe3XO7qxM+pk28acwFCaeTARXxPMCCTl3TReEXPo0nrc W5ejQ61bxVlRc2bgokOjh4XqGPjlZan7anjbQY7eGeOMyaZdwEN9z3IzUbOF+9yn36Ns 8pbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=IWftFaF/7pwaE+hKN0rmHHTDccHnFs4MwoJXhQKr9TA=; b=IQtGiaFa0byDjZzcOjjC8M6IqESTTSPPmm8m7qekCjC8+qpD5unrCKkK1qDv3NjxRb wiHZRfZx9BuVj+sBV8b5R3BOpCs0vRKMCkMsTVtPtNM2lRpcrqNTf6JbOvg/sTT3qtj0 aNgl+utSGZ3/Xf7pt05WDymFQvrXkg1NrGyH4iA0cIjjBGM4fe90RxoS/CylYeRpCJk/ kokfDzjhIs5i1IlKP/HyaoHiBPwFCo1U5SYGsDYdODDyL6q2Wznit96JYuW4Z+gq0QOv 0gJNvWMySgJ0AyFjVi/qdk9gvCNNDhEDMtXXdB06P1xF/X0HkrhVgk5+OoOVsLcU3lnN w36g== X-Gm-Message-State: APjAAAUPNp4C5ugOrvdfaYITh8DG7b7BXdgbf7KbGjXNQ28rPJ24lQDI 8qCwYAtWd2Z1TI7uZjTJ0SVab9OdKkr+UGw= X-Received: by 2002:a63:1c5e:: with SMTP id c30mr51963594pgm.30.1577397747273; Thu, 26 Dec 2019 14:02:27 -0800 (PST) Date: Thu, 26 Dec 2019 14:02:05 -0800 In-Reply-To: <20191226220205.128664-1-semenzato@google.com> Message-Id: <20191226220205.128664-3-semenzato@google.com> Mime-Version: 1.0 References: <20191226220205.128664-1-semenzato@google.com> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog Subject: [PATCH 2/2] pm: add more logging on hibernation failure From: Luigi Semenzato To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: rafael@kernel.org, akpm@linux-foundation.org, gpike@google.com, Luigi Semenzato Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hibernation fails when the kernel cannot allocate enough memory to copy all pages in use. This patch ensures that the failure reason is clearly logged. Signed-off-by: Luigi Semenzato --- kernel/power/snapshot.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 26b9168321e7..df498717a97e 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -1705,16 +1705,20 @@ int hibernate_preallocate_memory(void) ktime_t start, stop; int error; - pr_info("Preallocating image memory... "); + pr_info("Preallocating hibernation image memory\n"); start = ktime_get(); error = memory_bm_create(&orig_bm, GFP_IMAGE, PG_ANY); - if (error) + if (error) { + pr_err("Cannot allocate original bitmap\n"); goto err_out; + } error = memory_bm_create(©_bm, GFP_IMAGE, PG_ANY); - if (error) + if (error) { + pr_err("Cannot allocate copy bitmap\n"); goto err_out; + } alloc_normal = 0; alloc_highmem = 0; @@ -1804,8 +1808,11 @@ int hibernate_preallocate_memory(void) alloc -= pages; pages += pages_highmem; pages_highmem = preallocate_image_highmem(alloc); - if (pages_highmem < alloc) + if (pages_highmem < alloc) { + pr_err("Image allocation is %lu pages short\n", + alloc - pages_highmem); goto err_out; + } pages += pages_highmem; /* * size is the desired number of saveable pages to leave in @@ -1836,13 +1843,12 @@ int hibernate_preallocate_memory(void) out: stop = ktime_get(); - pr_cont("done (allocated %lu pages)\n", pages); + pr_info("Allocated %lu pages for hibernation shapshot\n", pages); swsusp_show_speed(start, stop, pages, "Allocated"); return 0; err_out: - pr_cont("\n"); swsusp_free(); return -ENOMEM; } -- 2.24.1.735.g03f4e72817-goog