From patchwork Wed May 5 14:05:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 12240045 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.6 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 A5201C433B4 for ; Wed, 5 May 2021 14:05:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EEC5B613BE for ; Wed, 5 May 2021 14:05:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EEC5B613BE 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 54E3D6B006C; Wed, 5 May 2021 10:05:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 50E276B006E; Wed, 5 May 2021 10:05:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 379766B0070; Wed, 5 May 2021 10:05:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id 17E816B006C for ; Wed, 5 May 2021 10:05:44 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C79AC45B3 for ; Wed, 5 May 2021 14:05:43 +0000 (UTC) X-FDA: 78107350566.16.A4F5517 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by imf12.hostedemail.com (Postfix) with ESMTP id C38E7F4 for ; Wed, 5 May 2021 14:05:29 +0000 (UTC) Received: by mail-wr1-f46.google.com with SMTP id t18so2000883wry.1 for ; Wed, 05 May 2021 07:05:43 -0700 (PDT) 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=CmkloHZMbYYsutWi2v9Qx78QF4fzXdmWotZ2Kv9nAZg=; b=UqyhSR4lXze/ooFXogbnFNZQ+l03UPDgvYFdrX8BICA3iusG9aMFtcbK7s7jCg2QcG WFMXu3XTeUG213ML1j/JYNZ7WZl9wpE/AFvE1zK+f9wzKiFi/BH+duc/L7SPNHovEn6O tgUORMpw1mLM4S1bZBLKTBh2v7LZurFB37a47Mh/hZ5Gz8qWChbScUSLrKbWKAa8zTHZ Hfr21OmOtrO/R8jweTqrNCGGtvtz0ssh/Yd14+oQ3VvBmxOxvMTHdXQKzMYonBHDC8Wn zDzNPM5HhJb8zfjSEUnG93TwFAc8t5naGG4vJlUDbeS0rhEecNL2k79ebaMjMpKJtxW9 dRQw== 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=CmkloHZMbYYsutWi2v9Qx78QF4fzXdmWotZ2Kv9nAZg=; b=s12TPcRfXHksqvtovcgtTgYHwwt8cNmHE9v9BaVqKr7HPUnQw/ised88dlb4D8q5Su SG0zxAnY9z9hjclGFbZtAU4LAB9JrCsKIcJNqDe0Wu6mgVOKp89OY1h403FuE8bbEc8e Agf375dRrjsAGGzbuVlslWP+EsJDGM/adGoKQCyDfS9b6bnTw+AZpYpVoIOU3DJW6f6y icH8uI7qZdQ/9hEORKEJdVqzKJXUCaHRgvinTTxz6d1CyjAVKycfso4RnhK6CUIPTtlK 60o8duZTgo85YooXwGCJBuvxFHV2TLQlmGcjC+l5Y0ulR714+fXF6nHIYb/kP43OdeSL KLWg== X-Gm-Message-State: AOAM5305R8EbnwrnG+YIKT/O8X5qBmXqwKW5og8RKmvrWcbr+0bneoNp OKnuI0HFqz40S0bQFWCHJZZFIA== X-Google-Smtp-Source: ABdhPJzDTH57HIhjDeThf/cNMDXb6vxbqDEYrjFgiBf9y9IzSYt9HIz/q/8dnK3sUbQx+7L3xIcRTg== X-Received: by 2002:a5d:5242:: with SMTP id k2mr38938187wrc.269.1620223542265; Wed, 05 May 2021 07:05:42 -0700 (PDT) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id f6sm23296476wru.72.2021.05.05.07.05.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 May 2021 07:05:41 -0700 (PDT) From: Georgi Djakov To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, georgi.djakov@linaro.org, Liam Mark Subject: [PATCH] mm/memory_hotplug: Rate limit page migration warnings Date: Wed, 5 May 2021 17:05:42 +0300 Message-Id: <20210505140542.24935-1-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: C38E7F4 X-Stat-Signature: prmgqfy67syb645po6paizb6uyzwm1kk Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=UqyhSR4l; spf=pass (imf12.hostedemail.com: domain of georgi.djakov@linaro.org designates 209.85.221.46 as permitted sender) smtp.mailfrom=georgi.djakov@linaro.org; dmarc=pass (policy=none) header.from=linaro.org Received-SPF: none (linaro.org>: No applicable sender policy available) receiver=imf12; identity=mailfrom; envelope-from=""; helo=mail-wr1-f46.google.com; client-ip=209.85.221.46 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620223529-487423 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: From: Liam Mark When offlining memory the system can attempt to migrate a lot of pages, if there are problems with migration this can flood the logs. Printing all the data hogs the CPU and cause some RT threads to run for a long time, which may have some bad consequences. Rate limit the page migration warnings in order to avoid this. Signed-off-by: Liam Mark Signed-off-by: Georgi Djakov --- mm/memory_hotplug.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 70620d0dd923..64acbdc6bece 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1521,6 +1521,8 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) struct page *page, *head; int ret = 0; LIST_HEAD(source); + static DEFINE_RATELIMIT_STATE(migrate_rs, DEFAULT_RATELIMIT_INTERVAL, + DEFAULT_RATELIMIT_BURST); for (pfn = start_pfn; pfn < end_pfn; pfn++) { if (!pfn_valid(pfn)) @@ -1567,8 +1569,10 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) page_is_file_lru(page)); } else { - pr_warn("failed to isolate pfn %lx\n", pfn); - dump_page(page, "isolation failed"); + if (__ratelimit(&migrate_rs)) { + pr_warn("failed to isolate pfn %lx\n", pfn); + dump_page(page, "isolation failed"); + } } put_page(page); } @@ -1597,9 +1601,11 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) (unsigned long)&mtc, MIGRATE_SYNC, MR_MEMORY_HOTPLUG); if (ret) { list_for_each_entry(page, &source, lru) { - pr_warn("migrating pfn %lx failed ret:%d ", - page_to_pfn(page), ret); - dump_page(page, "migration failure"); + if (__ratelimit(&migrate_rs)) { + pr_warn("migrating pfn %lx failed ret:%d\n", + page_to_pfn(page), ret); + dump_page(page, "migration failure"); + } } putback_movable_pages(&source); }