From patchwork Thu Feb 8 06:18:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 198187 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2718645dyb; Wed, 7 Feb 2024 22:19:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW3NFXjZlOtMUXabvH3WkeGZ/vqUAZS/Qlb7ZcaWl1JJFce965h+CXBzN84sRXps4s7+dGIod7nD3BvyN5r08541mO1HQ== X-Google-Smtp-Source: AGHT+IHPtD4ZtNR6OMbd5B+MXie/tH1xVo3UKVNwMEPQgLOTSkai7neCeVlOhrRoXxCCa8KjrACN X-Received: by 2002:a05:6e02:1542:b0:363:cbb8:53c7 with SMTP id j2-20020a056e02154200b00363cbb853c7mr11644988ilu.23.1707373160938; Wed, 07 Feb 2024 22:19:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707373160; cv=pass; d=google.com; s=arc-20160816; b=s5j5+ob+ThxcJqyH7yR/vaaHVsMLMDUtgFdVNGuHWe1qe1qi/ta90OOlym0BDXkfxL +SqlgU9LSwR0CSlCK+4gIhppIhmnMCCxobn8sfp+Qv4ea6dwg5JLPr5rC3BD9YXKMRSm ski7P02irmPAPS0LggV4iQrP1db6nHN/ta7Y5j25yLe4YO7oCB6PzJB9b2/WdpMmQMvl jqTkFx8jw9CTo/ND6lsRT7xy8Wz89XSPF4WyqlIECAFVQ3LkoikFdGHd70o0fD9S+JmG mHY7okPksCx+tSk8uUgsExSM6nzGvuXzI6fWVzWbQsPladty0kG+kLYv6RcE7Gqvryix jGDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from; bh=h8k0LVJhT/AtzswsIjpIerLLyRxbwWIQLpCIIUwzTPg=; fh=b9CCgozO7ilsS4I0G+rlKd0maMpxU4eqeK1TPyfzB6Y=; b=myhgzgOAmS3AVMiyVimFqXPCj/wlG3fZYTvqxHpeCl5kV7oQBPnYrV5VslbrNNJ90z VdjS7B8OqbI2arYu6Op8bAPFbJANRNXHzluBobvhck082QGUXL/Gwas0eHcYNWu5RgB+ sU7oz2joefc47adWOMcIRH+EwXJKiq4DNqcba+jT4XVUa0ljXLgSeHN1GxMrZIPB4HrZ BWy6XLg2sxmBBNVvZnmbYl9daealNgaXmhlGBkCMHHlBimdQqRZ6bN8mCDcTJnXSrZu+ glwrXyEKXzKL+dL3yqsb6lsRmSr6JETh9OvWgE4sD2ODMlMf8/yFgfwC2q6KRItVUkMO 8xcw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-57503-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57503-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCVy4jB3ADwp9qY5jxBvMFF3t235K4nLqwIl0NJF74IwXagagSyH7jRqFhX2TJze7w/pKDm+u17uVX5keTufhJRtNZRI2Q== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k3-20020a632403000000b005dc3563fc44si2936376pgk.236.2024.02.07.22.19.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 22:19:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57503-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-57503-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57503-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 045CF283961 for ; Thu, 8 Feb 2024 06:19:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6298D67E7B; Thu, 8 Feb 2024 06:18:51 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DEF7D67C70 for ; Thu, 8 Feb 2024 06:18:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707373129; cv=none; b=DYa6ivFnb19gySzfmFwyyiooe1p28kWyKoN84qgf46wihTgrvp0BpCtYD8JKq9uUpJN6NfXOAfbqdVVvB9gnThJitt+Dz2myZAeePeQBjHx44rSYpIG1KI3fidIWP8pVqFLEOjOKNDcfiTlreevirPdqM3+lbLdlhWoyyCzM3Go= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707373129; c=relaxed/simple; bh=jrWzJay/sTsuzrPvK8L2TqysXsAVN52IkjoORxSCyoc=; h=From:To:Cc:Subject:Date:Message-Id; b=C+u7d8nvzz+xzGqzEmccynIHnwzH4Gev4JRDNGQJzfZZdIoJnu7kTFX+6dR8HWLfMmFtnIsDL32Mw8endgCsQd95GhMU6mDo7xQpdpxYOxwnppGLCpW+iww//oBXudfdWGvsyMtzMw/NakZFPVCSeCVLdP3aw/VnH34cMRpHGHU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-d85ff70000001748-2b-65c4723b6356 From: Byungchul Park To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com Subject: [PATCH] mm, vmscan: Don't turn on cache_trim_mode at the highest scan priority Date: Thu, 8 Feb 2024 15:18:25 +0900 Message-Id: <20240208061825.36640-1-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFJMWRmVeSWpSXmKPExsXC9ZZnka5N0ZFUg1UfJCzmrF/DZnF51xw2 i3tr/rM6MHts+jSJ3ePEjN8sHp83yQUwR3HZpKTmZJalFunbJXBlHJu8jr3gCkfFod4zTA2M vexdjJwcEgImEjOm9MHZ6+eeZwWx2QTUJW7c+MkMYosIyEpM/XueBcRmFgiUWH5oDVhcWCBc Ysm9TkYQm0VAVeLB0+Ngc3gFTCWu/v7MCjFTXmL1hgNA9VxA9jpWiQffT7FAJCQlDq64wTKB kXsBI8MqRqHMvLLcxMwcE72MyrzMCr3k/NxNjEAfL6v9E72D8dOF4EOMAhyMSjy8J8oPpwqx JpYVV+YeYpTgYFYS4TXbcSBViDclsbIqtSg/vqg0J7X4EKM0B4uSOK/Rt/IUIYH0xJLU7NTU gtQimCwTB6dUA6ON5jHj7zvaa002/furxs4g9rbkQf+cmC+JpfENlXLTXD/82N36YGJJZ/Oa eSsfVh7vivDMCJjEIMn1rWFlX8yPpikngtJt+TTOKMhanz7OUrlH8sUvHe0XaS+5u5dfTD6f p5Gmr58Qk+qhZTDT1iBFSPra5kU7765o/al/kX9O9BeZbg1eEyWW4oxEQy3mouJEAIWV+Ert AQAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIJMWRmVeSWpSXmKPExsXC5WfdrGtddCTVYM05OYs569ewWRyee5LV 4vKuOWwW99b8Z3Vg8dj0aRK7x4kZv1k8Fr/4wOTxeZNcAEsUl01Kak5mWWqRvl0CV8axyevY C65wVBzqPcPUwNjL3sXIySEhYCKxfu55VhCbTUBd4saNn8wgtoiArMTUv+dZQGxmgUCJ5YfW gMWFBcIlltzrZASxWQRUJR48PQ42h1fAVOLq78+sEDPlJVZvOMA8gZFjASPDKkaRzLyy3MTM HFO94uyMyrzMCr3k/NxNjECPLav9M3EH45fL7ocYBTgYlXh4T5QfThViTSwrrsw9xCjBwawk wmu240CqEG9KYmVValF+fFFpTmrxIUZpDhYlcV6v8NQEIYH0xJLU7NTUgtQimCwTB6dUA6PF 05Ip4pI/TQUn5RtKPZt3KYdnUirbYhurZNYkxw+3XvbV5ske+K15iedigu/M6qKUtC+xO4x2 PpNeVO4lqDyj9/yGZ3qnu8Xfnd1zLvDhqZOVi1ZImWawKV9WEcuUKIgylsm4lb+CLzwk7UVA bekXiZsb5xyRjHO9bbH0aPLZZ0/POMQ/jFViKc5INNRiLipOBAC6SBcS1AEAAA== X-CFilter-Loop: Reflected Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790310519590349517 X-GMAIL-MSGID: 1790310519590349517 With cache_trim_mode on, reclaim logic doesn't bother reclaiming anon pages. However, it should be more careful to turn on the mode because it's going to prevent anon pages from reclaimed even if there are huge ammount of anon pages that are very cold so should be reclaimed. Even worse, that can lead kswapd_failures to be MAX_RECLAIM_RETRIES and stop until direct reclaim eventually works to resume kswapd. Signed-off-by: Byungchul Park --- mm/vmscan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index bba207f41b14..25b55fdc0d41 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2268,7 +2268,8 @@ static void prepare_scan_control(pg_data_t *pgdat, struct scan_control *sc) * anonymous pages. */ file = lruvec_page_state(target_lruvec, NR_INACTIVE_FILE); - if (file >> sc->priority && !(sc->may_deactivate & DEACTIVATE_FILE)) + if (sc->priority != 1 && file >> sc->priority && + !(sc->may_deactivate & DEACTIVATE_FILE)) sc->cache_trim_mode = 1; else sc->cache_trim_mode = 0;