From patchwork Mon Jul 22 10:23:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhaoyang.huang" X-Patchwork-Id: 13738656 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 33DF4C3DA5D for ; Mon, 22 Jul 2024 10:24:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8DF0D6B0088; Mon, 22 Jul 2024 06:24:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 867FE6B008A; Mon, 22 Jul 2024 06:24:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 708A86B008C; Mon, 22 Jul 2024 06:24:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 52B1B6B0088 for ; Mon, 22 Jul 2024 06:24:18 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C36161616C1 for ; Mon, 22 Jul 2024 10:24:17 +0000 (UTC) X-FDA: 82367003754.29.5D0CC0B Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by imf15.hostedemail.com (Postfix) with ESMTP id 01780A001B for ; Mon, 22 Jul 2024 10:24:14 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721643833; a=rsa-sha256; cv=none; b=2h0GSdAQKqlm3LPHLAm1BKs7fYMvOlffPbcjRxuIV6pWrf/QKt+Etgo5NcpvTjBprdxRtC df7ydABzZCirWRxFX0r1jAT7HBHyQMld4SI1K1Hf+p1DT35DPPszhGrDxySo3w3iUHKZe5 eezhubWwdTIUcIIJk3SjFY6T80xdbpE= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721643833; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=56/r2zMVEVI6t2Pg2pdTMutroKK4oHBySyGx99wn2lc=; b=aEqqtaZCOzjJe5VmmIKjz/YeiSqM188rK0hWnwmNMlnxpwLX7LFgk7/i2gePZNrbaVmhJP zph6h91nfadiTvN7jZJVYZYzO3DesY9E0zWDhDjzoZru04ZEhlCUdcXns6hwpY6UVbIGWH q4Mo0SxAJc4SBmuQ/5SaK+giqhef1/w= Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 46MANwUb069811; Mon, 22 Jul 2024 18:23:58 +0800 (+08) (envelope-from zhaoyang.huang@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4WSGSv3ZhQz2LFXjq; Mon, 22 Jul 2024 18:18:23 +0800 (CST) Received: from bj03382pcu01.spreadtrum.com (10.0.73.40) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Mon, 22 Jul 2024 18:23:55 +0800 From: "zhaoyang.huang" To: Andrew Morton , Yu Zhao , , , Zhaoyang Huang , Subject: [RFC PATCH] mm: keep LRU order by move unisolated folios to tail Date: Mon, 22 Jul 2024 18:23:38 +0800 Message-ID: <20240722102338.2567810-1-zhaoyang.huang@unisoc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.0.73.40] X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 46MANwUb069811 X-Stat-Signature: 81dxo41cau4mwjwup5hu5gzjp35txtma X-Rspamd-Queue-Id: 01780A001B X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1721643854-402983 X-HE-Meta: U2FsdGVkX1/d1x4Md71EDjOp2Sn3qDgSRceDh+mnCD5FmhzaokWsdgod/fBFEAH4+3qS+7X4tnAt6ZSSqJfkLakQoFkocJ/9pnZnCY9LXNvC2ckC/nNti+UAvEtjAVgKg3B1QkMxKKCmLcm3eEfEZIWoxtQLFRimRYz+P/BZIYEv+/1OLbZlw5KFrieHyhFHwKtpjKQg/i0e9OOXo4ESqn4nLUtDcS3OWoUpeUrBrO3Ne2QrFalf3+hN80trFoQ0ppc0fHnL8H4Yxz5xnTG2jbLg46bJ7M5OyhGUQHFRMezlfbRktkFY90I53ewdcgLhMl1MZsJb6F2qJu3/Yd+zwTTO6UdofZdffU/CfbXwOK/jX8Q72m0iTypsgqga7ufaDH4+ubu8CdBl160jRUkR5XdCk0O+cxCP/hq0SAFVgHDrelfM3YRtChiv5tXTaf1X4NJ2j+Rzgl9P7OMG3Qd/BupUzis0N6N1gFFyBN/Ny88hAyxJsq0zASoHhzhGfa4TxJiL2oG+aIdvY7CEfevK8qzzoLfwcvNsPAVeeey2pm16DUF2oGpknvIVR1VL8IoevgRqek08rZ97UVCG7V1S7JCjGvwiN19jTn/DI60FEF7IPqtZh9q3w1qT0JckNXWLaxB4i5fwg8l1CQYNtnV9eTow8TipJlSwLYypXQ14DxKqKq9No1jkpI6Q8a5IJi88twprflllMEjtN/sGItSVvIb+Ocassbx2IQGHWu7BGXw1VUgCZ3eaH+YGViAUIrP/Z6AFsnA2S+XMKsUl0Wt37l1CPKfFMyCThgkKYV55vEc4duEMb1fKXDcFbtBteFO1bPmleocO3ulrgBNgA0sOsDjaZsmZZV9ykVfLwmXJca+l7RCskVAV2F6wMfZwSWW5otgcpx5lXAXRwSp4jVjs5A0swXCAnLRdgdYgh6rkGmtQGB8o5fgeQlHoTaJ9PTsvemWUeCAI+OLo7I+cTvz 04IndZg/ V5EFsQcXakoM0DGQFDkm6n0bkytRPoazEYFtMgsruWdTiO+UQkmBeL+Pow5vuCqpLsDoeH9oiBKLTkcDmLvPxUz1BbKQcV1fG0UuinDsJs6W9X6Ez1O5buQ1MNXHJ0wrJmMeJcyc7pPWhsRUzg+BSQ0JyUUHFd7sdnkRShm9+4lUbWEmPossMrG1n34oW5kZCyi12 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: List-Subscribe: List-Unsubscribe: From: Zhaoyang Huang Unlike legacy LRU management, MGLRU will switch to other zones or types when current lrugen[gen][type][zone] scanning failed, which means skipped folios could become available in next scan. This commit would like to suggest to keep the LRU's order by moving unisolated folios to the tail of LRU during the first 2 round scan to avoid potential livelock on the unisolated ones. Signed-off-by: Zhaoyang Huang --- mm/vmscan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 2e34de9cd0d4..cd1f38bb1d45 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4397,7 +4397,10 @@ static int scan_folios(struct lruvec *lruvec, struct scan_control *sc, } if (skipped_zone) { - list_splice(&moved, head); + if (sc->priority > DEF_PRIORITY - 2) + list_splice_tail(&moved, head); + else + list_splice(&moved, head); __count_zid_vm_events(PGSCAN_SKIP, zone, skipped_zone); skipped += skipped_zone; }