From patchwork Mon Feb 1 14:20:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 12059087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29DE0C433E0 for ; Mon, 1 Feb 2021 14:21:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C5F2364EAB for ; Mon, 1 Feb 2021 14:21:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5F2364EAB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 32CBD6B0080; Mon, 1 Feb 2021 09:21:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 302096B0081; Mon, 1 Feb 2021 09:21:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A25C6B0082; Mon, 1 Feb 2021 09:21:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0227.hostedemail.com [216.40.44.227]) by kanga.kvack.org (Postfix) with ESMTP id 068A46B0080 for ; Mon, 1 Feb 2021 09:21:00 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C40C9181AEF1A for ; Mon, 1 Feb 2021 14:20:59 +0000 (UTC) X-FDA: 77769910638.03.loaf72_1c110fd275c2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id AF18328A4EB for ; Mon, 1 Feb 2021 14:20:59 +0000 (UTC) X-HE-Tag: loaf72_1c110fd275c2 X-Filterd-Recvd-Size: 4501 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Mon, 1 Feb 2021 14:20:59 +0000 (UTC) Received: by mail-wm1-f44.google.com with SMTP id j18so12803051wmi.3 for ; Mon, 01 Feb 2021 06:20:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Qm7Jt2x0s9JgF26OHsGV3axILPja8aYp/XWSz+LFWt0=; b=y9t+UrASMPrswsDAnJKQyQlHLabM3YdAkO/JaXG/SeTagTDvne4m2pUq1wQdI6Kg7v d0WyYshWBrJ4UxduXJETdMjhVw17qruBEb6/Xs3WURsthNVfiKRfsOLFuG5qn1gJMBJj 7uxV5e+jpZui7pThvEABUZT7kGX0Le+5No+pDiqaULvE1sFnT81Nw6mOrjnCAd1LYleP wOT19mCkpgNJtu7gnTReRmzpNObECIwkq5p+VeowfYC+/GNve1IQ7iCbHejRNFaQCPWD DIBK5TtAF9xL8qISH3SDDor/FA4BLbl/TODkbUeQa9LI6iU3J6ecHKIxJqpaim6xUs9l MJcA== 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:mime-version :content-transfer-encoding; bh=Qm7Jt2x0s9JgF26OHsGV3axILPja8aYp/XWSz+LFWt0=; b=TnbyEISLyDxPEp+GlrCbQVKouafE1eaGadIaio2BbHQ30/3DLWD9Q24QIXt76lFZPC I3JtQmbED2mPa5Mye6GZwn5sfRQHTq1N1Rhswc/wBkCH5Kw31scULiQbwTWr6Ax7jq7+ 158iozIzHLzoz0gX/Ez7EHPZVPOWl5O8HUkRPpuvgMk6qbWXBFOwdi8E3N5BP7Qw8q+a 9HbiHYDKEr4jnKtcO1r5U8mspqqMo07k0rrgbidn8vZ+/BFuaC2C0VLbe+LpxXq7e4vQ 3Ut//GYZ5Z+w8epzK9/EDDPCSilcScLQZlO1syAAoilxDiVhwsaqS+EJ21iiEeR05AiY HTyA== X-Gm-Message-State: AOAM530iefHMasxux3wU/lcKZX3ZGBZVDx5z5wd6f1MK3up1AxZ9LNW/ 3in5Qpyv+bkAE1ymraf6eGfFAw== X-Google-Smtp-Source: ABdhPJyBZFWnw6y1sShBINT0Yg5ZzaFmerG+/NvkruCBtCPNMHHs7rjHGN0KHfC4hAEoPxAO1XvuQw== X-Received: by 2002:a1c:f604:: with SMTP id w4mr15427426wmc.39.1612189258057; Mon, 01 Feb 2021 06:20:58 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id r25sm29071604wrr.64.2021.02.01.06.20.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Feb 2021 06:20:57 -0800 (PST) From: Georgi Djakov To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Georgi Djakov Subject: [PATCH] mm/page_io: Use pr_alert_ratelimited for swap read/write errors Date: Mon, 1 Feb 2021 16:20:55 +0200 Message-Id: <20210201142055.29068-1-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.29.0 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: If there are errors during swap read or write, they can easily fill the log buffer and remove any previous messages that might be useful for debugging, especially on systems that rely for logging only on the kernel ring-buffer. For example, on a systems using zram as swap, we are more likely to see any page allocation errors preceding the swap write errors if the alerts are ratelimited. Signed-off-by: Georgi Djakov Acked-by: Minchan Kim Reviewed-by: Miaohe Lin --- mm/page_io.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 92f7941c6d01..485fa5cca4a2 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -41,9 +41,9 @@ void end_swap_bio_write(struct bio *bio) * Also clear PG_reclaim to avoid rotate_reclaimable_page() */ set_page_dirty(page); - pr_alert("Write-error on swap-device (%u:%u:%llu)\n", - MAJOR(bio_dev(bio)), MINOR(bio_dev(bio)), - (unsigned long long)bio->bi_iter.bi_sector); + pr_alert_ratelimited("Write-error on swap-device (%u:%u:%llu)\n", + MAJOR(bio_dev(bio)), MINOR(bio_dev(bio)), + (unsigned long long)bio->bi_iter.bi_sector); ClearPageReclaim(page); } end_page_writeback(page); @@ -106,9 +106,9 @@ static void end_swap_bio_read(struct bio *bio) if (bio->bi_status) { SetPageError(page); ClearPageUptodate(page); - pr_alert("Read-error on swap-device (%u:%u:%llu)\n", - MAJOR(bio_dev(bio)), MINOR(bio_dev(bio)), - (unsigned long long)bio->bi_iter.bi_sector); + pr_alert_ratelimited("Read-error on swap-device (%u:%u:%llu)\n", + MAJOR(bio_dev(bio)), MINOR(bio_dev(bio)), + (unsigned long long)bio->bi_iter.bi_sector); goto out; }