From patchwork Sun Apr 2 10:42:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 13197369 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 40249C7619A for ; Sun, 2 Apr 2023 10:43:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF25B6B0080; Sun, 2 Apr 2023 06:43:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA29A6B0081; Sun, 2 Apr 2023 06:43:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B43A56B0082; Sun, 2 Apr 2023 06:43:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A52EC6B0080 for ; Sun, 2 Apr 2023 06:43:35 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7B06F160768 for ; Sun, 2 Apr 2023 10:43:35 +0000 (UTC) X-FDA: 80636114790.14.77689F2 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf20.hostedemail.com (Postfix) with ESMTP id 25A721C0005 for ; Sun, 2 Apr 2023 10:43:32 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=ULvxw8cW; spf=pass (imf20.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680432213; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iWLz2c/gJjiIgPXQ1aSY7TJGPEGrwoNldjR8gzjw7to=; b=YkyrCd+uSyNJbbXxxtsadHpM6bhvUJDZ6DJe2DyyBjz2qDlQ9WO4yWlgAeVLu6igLp/t+E 8PlG2a/Y4znQ9EitTYWvYvyg3fpgNj3Jplevjk2R3bo1IIF8bO5IIlfanzoTkUROX79Brk VmfnthY8JDsnWL0N2B9VfJaRNpFh+XA= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=ULvxw8cW; spf=pass (imf20.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680432213; a=rsa-sha256; cv=none; b=bbbsLbpt0KnkOTf8RvgeBFlBjO+mae1PR/Xiioc2xgpNmMnh7E+IR65VrsH7VJw4bKmfoW mSl+/LBrzJpKx7g1zKuWvhUcnDujRhh0+sKMiKPRqY2Vxe2U+RNDlejNbSAMhpjIPqvjQ6 mtfB3qXrlsqgXUZL+3KReOkh3B+6CEs= Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3327H0uh028662; Sun, 2 Apr 2023 10:43:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=iWLz2c/gJjiIgPXQ1aSY7TJGPEGrwoNldjR8gzjw7to=; b=ULvxw8cWYRt+fMlc49TznFjncrJ9Z9Jr7pi3sRm64GdloEWe8bZTzv38/0WDEjJL5Aga 5R+Oy4yjMmg3JDPfSP5u7U//SH1uPiTTr/83N/7HTK2D6DrJ22UwUVMHCMKhkcnsKCBF Qahg1ROdxB7CViNzo5LJVn7NO2u0f0ZxRSb6l6SQpj0uas78DjF+IMzvvMi37mpSr1p/ UramEXXEDO2soDxpsK3NBlIKAMe3j30TElLu4Ua0Z6+IU6SCQ+Gf9+ocv9h48NfR0os4 LzIX5V5/4diXFYGb6f1QbHQ9QqzLlOye9ulFfhToJT2p7dg352/pPR7WiZRDR7wXNMoz 3g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ppx9jfdmq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 02 Apr 2023 10:43:29 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 332AhTgu026533; Sun, 2 Apr 2023 10:43:29 GMT Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ppx9jfdmh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 02 Apr 2023 10:43:29 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3328FLB7022391; Sun, 2 Apr 2023 10:43:28 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([9.208.129.116]) by ppma03dal.us.ibm.com (PPS) with ESMTPS id 3ppc87yj54-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 02 Apr 2023 10:43:28 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 332AhQZC38863308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 2 Apr 2023 10:43:27 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A354458064; Sun, 2 Apr 2023 10:43:26 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F9B758056; Sun, 2 Apr 2023 10:43:23 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.43.8.200]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Sun, 2 Apr 2023 10:43:22 +0000 (GMT) From: "Aneesh Kumar K.V" To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: Dave Hansen , Johannes Weiner , Matthew Wilcox , Mel Gorman , Yu Zhao , Wei Xu , Guru Anbalagane , "Aneesh Kumar K.V" Subject: [RFC PATCH v1 7/7] mm: multi-gen LRU: Shrink folio list without checking for page table reference Date: Sun, 2 Apr 2023 16:12:40 +0530 Message-Id: <20230402104240.1734931-8-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230402104240.1734931-1-aneesh.kumar@linux.ibm.com> References: <20230402104240.1734931-1-aneesh.kumar@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: loGqJUH-3JvGeve_OsWoPALQAY3EBr_I X-Proofpoint-GUID: fIqnqiU6yumCrdSyTi5PahbDBS0Oep20 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-31_07,2023-03-31_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 phishscore=0 mlxscore=0 malwarescore=0 bulkscore=0 suspectscore=0 clxscore=1015 spamscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304020092 X-Stat-Signature: pkhy3ctsw16kbba4keatr4kjei5kida6 X-Rspam-User: X-Rspamd-Queue-Id: 25A721C0005 X-Rspamd-Server: rspam06 X-HE-Tag: 1680432212-325334 X-HE-Meta: U2FsdGVkX19Fpxcuf6sKQC/irP26ALXkSLUrs3VSxaqxP9IBPU9i6PodmK1rqrVUTdaNpsLGnfjfhmkS9/1DHxZFh5WESfdqBBwyS6BO3zVRz4wKObKHn/qXnRotPZzfXrzVT9lZmPchAY/MrerVmxKreG4S+3lB8zZ64eDNndAC8n4TIAdVjgLYez9xDWJudbcpgio2qKqk33JLKjo8FLX1hZb8k/ERqYLQzW/J/QXfZRf0098cUDB+lyFQ+1EjtGApdhK7ZgXQjxwAytp9fp6z4awlN+fdr6lhFzSho+vwSAcSsKydX4DEaQittEYIzWkbl0z+oAvBlx95TNThL4kflGCnnvDZEtIjydzc2ASspfKV7PZkh8HBikWgR4cngxr2w675dC/CETVV0TG974KK7ZhQ939FsuzpfMo9e9ZD7aQ9J+Nhkb+ywsrBjIl/CeJmkx3CtKinURvSt9mxFHkL7i5b28dhteCdALMNfU5c4HLVS7fuykjkRBNMl6yGxZ+jjXMLpbBfk6w+YC6RkfROA9g2o43H0v8OsniU3WljEdnt2V0F8tMaBw271EcEA8a2eB4kkEu9or3pa0YJ8gplLJQjnqRSL+vjUGpSHl6XPD5zNgXWGykL4xelfyrNM42FPxAB7oA6zDx+umw5n39gcZnZgxqY7PV00qHIgiKlRLrwdKBfTdqjdmLMrTda6fqfbIovSsyJGR6AZ0t2CLtlmDcCg777xg/bNwewn+pQ0fmFOPUf9aW8WD6vk+aV1KzSYVDu7m5c9p9lUcbpRs58RZB0tNkIevXWSIQQY1aEG3HwNr63Hr48DoX20RnHqv30dbcYiwkHgNNlY13MkvyWcH5F/X3uM1/hvbGmEiRV8MhEutWE+DLVBW8FcWisPctix2cHEKNjsjXDH4RCL5ErieNvjSblh8W9n9YyefeDf7m9zGWeNbfMaX+r2co20jFGGcBvpbmPCC+FVaS R7UoJZXJ ueOKCrcmtCZMfLcvcz6k64ICM8ec3NdI0wlHLfWRSweiefEsap/RhIfeiZcT/H1+0vQDxcP/UY+vCBTGTxQqcuxVQh2UPUUWHJTfKioI6z0H3IuuPAUQH/NUtDqJrZuNLA5pzybqlikO4zApj2HnKkOrGr14UOhQ8tW2M 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 arch supports page access count, we would have already sorted the lru before collecting reclaimable pages. So unconditionally reclaim them in shrink_folio_list Signed-off-by: Aneesh Kumar K.V --- mm/vmscan.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index a5f6238b3926..d9eb6a4d2975 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -5242,7 +5242,8 @@ static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swap if (list_empty(&list)) return scanned; retry: - reclaimed = shrink_folio_list(&list, pgdat, sc, &stat, false); + reclaimed = shrink_folio_list(&list, pgdat, sc, + &stat, arch_supports_page_access_count()); sc->nr_reclaimed += reclaimed; list_for_each_entry_safe_reverse(folio, next, &list, lru) { @@ -5477,22 +5478,12 @@ bool lru_gen_add_folio(struct lruvec *lruvec, struct folio *folio, bool reclaimi */ if (folio_test_active(folio)) seq = lrugen->max_seq; - else { - /* - * For a non active folio use the arch based - * aging details to derive the MGLRU generation. - */ - seq = arch_get_lru_gen_seq(lruvec, folio); - - if (seq == lrugen->min_seq[type]) { - if ((type == LRU_GEN_ANON && - !folio_test_swapcache(folio)) || - (folio_test_reclaim(folio) && - (folio_test_dirty(folio) || - folio_test_writeback(folio)))) - seq = lrugen->min_seq[type] + 1; - } - } + else if ((type == LRU_GEN_ANON && !folio_test_swapcache(folio)) || + (folio_test_reclaim(folio) && + (folio_test_dirty(folio) || folio_test_writeback(folio)))) + seq = lrugen->min_seq[type] + 1; + else + seq = lrugen->min_seq[type]; gen = lru_gen_from_seq(seq); flags = (gen + 1UL) << LRU_GEN_PGOFF;