From patchwork Mon Oct 14 22:12:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Xu X-Patchwork-Id: 13835528 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 695D8D18151 for ; Mon, 14 Oct 2024 22:12:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D27286B0089; Mon, 14 Oct 2024 18:12:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD6006B008A; Mon, 14 Oct 2024 18:12:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC3FF6B008C; Mon, 14 Oct 2024 18:12:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A56D86B0089 for ; Mon, 14 Oct 2024 18:12:34 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 055B6AB02E for ; Mon, 14 Oct 2024 22:12:18 +0000 (UTC) X-FDA: 82673607450.17.1A46E13 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by imf15.hostedemail.com (Postfix) with ESMTP id CA010A0023 for ; Mon, 14 Oct 2024 22:12:25 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=J1zO08JC; spf=pass (imf15.hostedemail.com: domain of 3TpcNZwcKCPEpXbqnZVZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--weixugc.bounces.google.com designates 209.85.214.201 as permitted sender) smtp.mailfrom=3TpcNZwcKCPEpXbqnZVZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--weixugc.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728943810; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=StVEPLlBONEMwFAfdA5SiN1ofT0Acong4DzVn1DhVfw=; b=r/jh+ZTEDEpmVQVv7ubRB0m6jIMoHTfN2etVa+Al8t6kp4EYW3dNHNo56HiJNnYgebvkJk ISIaw4DI0EhAmC1uiyrUtk0JA/1Hl407FcgZyejbstkiB2Cl1z7MaD8E2yhHznoL/CmvuG 5zqcAn4np+R18lZMScic7NYRgL3uXSQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728943810; a=rsa-sha256; cv=none; b=zqtdx3x1f1P5y2Zu/TawM0oRRR6FFzMrYhuA52nSnHX/b7csZKPKzGgV+7+pHhtoSx7yi8 dy0lkTVOct6sEzpb8Ywec1b5kjumIFsoVD3CHnKxzr+cTP2TFvrEuJ8Xrux0QzIEXoJvJz vt4JhWd7Q1v3in/bBqRO+BBd/mALGko= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=J1zO08JC; spf=pass (imf15.hostedemail.com: domain of 3TpcNZwcKCPEpXbqnZVZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--weixugc.bounces.google.com designates 209.85.214.201 as permitted sender) smtp.mailfrom=3TpcNZwcKCPEpXbqnZVZhhZeX.Vhfebgnq-ffdoTVd.hkZ@flex--weixugc.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-20c8b0b0736so35921785ad.3 for ; Mon, 14 Oct 2024 15:12:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728943951; x=1729548751; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=StVEPLlBONEMwFAfdA5SiN1ofT0Acong4DzVn1DhVfw=; b=J1zO08JCOyQjg9lIHOXfS7vgRh24Ix+kVzi4HPQvW8xKeXVzQ6hjNh9+yDL/DLZrnD ZQhMKq5hbQLDSWoKXe0k2Ky+iL+tE07R/6Zzs/lOocgkmlfgBqrjmur9kNHib8Gfyl9t Dt4APyK/9FgpxeWM1fCOd3tKsVUA1/1fmEdhORDyOmUOO4hPJ6MB4Ybj36f6x2ObbDWA h6b+mkxbfHxRfCNPIdAPhIbtByNdlLmcbkZy2xkSEstJHp5XEv3EZeHgv6vx0dVyxzIP vnJeH4iBcMIT0CvkNJjLS0u8pXPJ7CNe0Fax9GE6jfbIMMBL98c/U+eZ4XL+YDVi1Dvk 0Kaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728943951; x=1729548751; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=StVEPLlBONEMwFAfdA5SiN1ofT0Acong4DzVn1DhVfw=; b=ds/LXjQ4ne2a4vZFvF+iTi+CSkhoTcvS0gnukzcZHBVS+N+INLuUr0nYbZrL/guucQ l2lLaeiM7+iQ8GTDYw0msu8jjIBoX8uUaFtVQ1Y2h7+Eqmq/KGmWTijlFq4BeJ5iOPGf CTgb030L4r/s5CNtFuDAdNyzX7L58hns1f0MxVrs0TufWL/arU1O7Xf9LWceuDmUba68 7EEC859YIvXcNgP+UNBE0UBvKJpF+509AdfI3tnJOfPME0ljWLnMeknopNgsccd1JKd/ 5MuicNmU086CDeZ4ixWbmcQ7ufQnO4Fg5xkDiTeug7whLSzXQmr5rLBB412jJI4ZtIUK tD8A== X-Forwarded-Encrypted: i=1; AJvYcCWlyW+u5xjjlYmivfqezCd6kQ59YYGHlHqf6zmXVNqNGi0kcVkUaOUOJVv9WJlme5HtV0waKJfUdA==@kvack.org X-Gm-Message-State: AOJu0YyCaMQVURJnZRtS59OaTOVO8d107tTTrrxlSStamSgCNtr/1H4v l4ui+xzSJD/dwrvwKY/EB+i3ouWZ3Y/Qos+GpSxDb4bjdxn+DUptdCSJACMwtWny8iQ0pkumW5p TbYEE5Q== X-Google-Smtp-Source: AGHT+IGdWq3ur/1CLZxNkGUkotrxh2qaCJZVTMSVykoVMtaGwuXheZm8sohIFrC3G7BSLGKky9qVb6Inlz7W X-Received: from monterey.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:641d]) (user=weixugc job=sendgmr) by 2002:a17:902:c40b:b0:20b:7be8:8ed0 with SMTP id d9443c01a7336-20ca142a427mr560145ad.2.1728943950779; Mon, 14 Oct 2024 15:12:30 -0700 (PDT) Date: Mon, 14 Oct 2024 22:12:11 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog Message-ID: <20241014221211.832591-1-weixugc@google.com> Subject: [PATCH 1/2] mm/mglru: only clear kswapd_failures if reclaimable From: Wei Xu To: Yu Zhao Cc: Andrew Morton , Axel Rasmussen , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wei Xu X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: CA010A0023 X-Stat-Signature: k9spc1kf9nf8wgp77a7hck7uauscqs4b X-HE-Tag: 1728943945-315477 X-HE-Meta: U2FsdGVkX190MDXWwPy4KdLrx6nhnLWG0URL9Xnizd/LXJ/WlQquJSxD7VaX5/NPhl+tXT480iQ+IMZCziWSg5G19ByTdbv69UEyZpiO4zbXazyYJlNM9cPXK4xP56vqc4C/Dc9BvhzLAjaUd4RludTn6L3ao6hXU+TTRu/66BeoyAuy/jdUKODPcvp7zvaYfOvBDKKUvF0B8eucY7wUG10K1me9Y6vgZCsFwC/g5aBK45tC1g/yUwHLzzRs+5QCjelpiDs5/BhFjqrz/54C05IhPIzyXIF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G470PJdATjB3MEkgtk3Un+k4IYVSordAKVLSy7UpQeHKV7wMsrYDi97MMeuLHS9/E92su3txigRuWXdXJ30alPjNAKTIZvWkDzkSlqUCBkSI6VDMOvingFrxsNB3GatCpktLQMJP/GOL3pv3DMKu1iNDyvEUW+cu7jnLuY199fn4pc4ADqOiRLyWPY2nguXEBHocagxUWHW6Nh3OZEvAtY7mj1qriQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000033, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: lru_gen_shrink_node() unconditionally clears kswapd_failures, which can prevent kswapd from sleeping and cause 100% kswapd cpu usage even when kswapd repeatedly fails to make progress in reclaim. Only clear kswap_failures in lru_gen_shrink_node() if reclaim makes some progress, similar to shrink_node(). Fixes: e4dde56cd208 ("mm: multi-gen LRU: per-node lru_gen_folio lists") Signed-off-by: Wei Xu --- mm/vmscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 50dc06d55b1d..9d1e1c4e383d 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4970,8 +4970,8 @@ static void lru_gen_shrink_node(struct pglist_data *pgdat, struct scan_control * blk_finish_plug(&plug); done: - /* kswapd should never fail */ - pgdat->kswapd_failures = 0; + if (sc->nr_reclaimed > reclaimed) + pgdat->kswapd_failures = 0; } /******************************************************************************