From patchwork Sun Apr 2 10:42:37 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: 13197366 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 8C903C77B60 for ; Sun, 2 Apr 2023 10:43:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F404B6B007B; Sun, 2 Apr 2023 06:43:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E9F766B007D; Sun, 2 Apr 2023 06:43:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D191B6B007E; Sun, 2 Apr 2023 06:43:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B41B76B007B for ; Sun, 2 Apr 2023 06:43:22 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8641E1407A4 for ; Sun, 2 Apr 2023 10:43:22 +0000 (UTC) X-FDA: 80636114244.19.7006992 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf01.hostedemail.com (Postfix) with ESMTP id 5566140008 for ; Sun, 2 Apr 2023 10:43:20 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=hmAi8lkS; spf=pass (imf01.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=1680432200; 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=H5xo3KX2h7RxDESOc++RDKuwt8D2+IlANc/bnVmey3k=; b=bSOaT0k4a0vaPiFUkQ26BGGDlBsAszpfzAwM0/pTj0cK59lefxzgK3J0DuNxS9N/nPQO3I U6yJmP4VWhCzVSDQ4ZCGal4BU3kIgBrWU0kLWng6+4IOOUl+Qcgm6lu31Xw4A75ephe4nQ OOTfKOSeAoWcVeSSlfblngv+i3dJWAk= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=hmAi8lkS; spf=pass (imf01.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=1680432200; a=rsa-sha256; cv=none; b=T4RbZuHtpAmpjJFTPSwiV1zxneg+B5dfpLWMrF1/Gt5boknJsEgJ5xdTO1ddV/WtgYVp1Q zO+5ko8vV40/98tB5Tg7nM/tczg3kVm9/BWlVluRyTMKAIQvPTzzGq/x7+/KXI6511mbF2 MrOnEKhgPJM8/smogdOB1hAjosXaijM= Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3327QHKd024183; Sun, 2 Apr 2023 10:43:17 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=H5xo3KX2h7RxDESOc++RDKuwt8D2+IlANc/bnVmey3k=; b=hmAi8lkSdBpy90ZRq19cg0tN+OPtGNhh6aZ8e+QLvyUVisvHrwKcfzptmTBZQlKREcbA 3YHO2NYSqcOY97IbNlNiyqTb0F9cDOe6Z/0wS3eBgiKW9BJVuDw/GGyo1dqFBvp2HJ2B AupgAdqBbTVY6XLEOq68/ehYtH+bAiKPgWn5scsWGN3+CJEM7CklGF7HgefXJ7stIO7c 23KoB8uI6otrTjfGiqaH6mJPczpOg1NIkw1sUGyUelt4/fIPNLGlx/dawDlLzxILR44Q Lv6dNrT781Hsw9hDvvgPDDOnZWtpRMozqIo5sMNUUZurPr4XP4CnBnTQ6pTSdgPVsepp KQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ppxf6q6rc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 02 Apr 2023 10:43:17 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 332AhGFn031269; Sun, 2 Apr 2023 10:43:16 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ppxf6q6r2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 02 Apr 2023 10:43:16 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3328ObV5016948; Sun, 2 Apr 2023 10:43:15 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([9.208.130.98]) by ppma01dal.us.ibm.com (PPS) with ESMTPS id 3ppc88fj7a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 02 Apr 2023 10:43:15 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 332AhEgI14615048 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 2 Apr 2023 10:43:14 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E8A6458063; Sun, 2 Apr 2023 10:43:13 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 27C2B58056; Sun, 2 Apr 2023 10:43:10 +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:09 +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 4/7] mm: multi-gen LRU: support different page aging mechanism Date: Sun, 2 Apr 2023 16:12:37 +0530 Message-Id: <20230402104240.1734931-5-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-GUID: uWEiwNEkV-VugLYlvXKiQMA0Z8iyvpVU X-Proofpoint-ORIG-GUID: LmiSZ2wYkVlfp2zi1XH5yq7XNqrJrP9f 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 mlxscore=0 bulkscore=0 clxscore=1015 malwarescore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=916 impostorscore=0 priorityscore=1501 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304020092 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 5566140008 X-Rspam-User: X-Stat-Signature: f65bmxep54oo69r693xhedxgtitpj48n X-HE-Tag: 1680432200-767787 X-HE-Meta: U2FsdGVkX1+bcxZ3u/kDYXU/53Ud1nf1AbfyKCK1nvwrIEXLqLVNPlPhiKFZP9gTl26ffuwr4TzzMr6H4iKNOgYsZTw1UuBlquRytPW0y6WC/NQenhE4k/vaRtKhlDWryH5lPb69y5BjYRwpBu6vVrsnwcT3Cj9AillWX0G5jKmMczeJU8zxFU5pXRI8N4z7SkfCJcs7NKcLE10JhI6tJ4xq4OSE7nJ/kXzLL+0axMTJMUXqW+V+0kQNldVa2GD79Df+JUgzaeX/WKNMtMV+xgmEkd7D2DFCu9WcO+uLU2MULlonxLv0I2y/hMqL6U6KePBUEQDbZ2gFaLnM+6uggUBT6OFHDA9mjE0ZBlPLUsihFpMoZPGWsozZei0czT13a9o3jJcNPEeEyDqRg74/W3TbgTE3jFpjQ+qNedWKapVaLfyyG7mJeOUYh5gzyyAnnKKI7KcCnAnZAvlcu8VuEsk50STqh8hvLuISB78JaSUvtFiVrsws4+c3umcG3JDQRQdHaWhrX7ClHmzpYeW76bUkmWv/XVzKSsgruGjBVtt0RjjTwZglZkhOegxWELjMsMeSER2epI4eUHGtc+OJMWaD6Iwirt4fHFWVnqssP7x+UYHvVI41BjWybzuuvWA34zwnIE5dA9gCjkW8W1Vr2rrYgtd42OnoIaa0PP/necgEJIX/reW4N1sGxHdZq+a36cONCZA2GhwKtcjFn/GtfRE/kjyExYamXHsfgqqB59x888edANC+wF3iEZw3mW73AbBKKqWE68/4GPUpuz6O1VqxCFU2yJsjEwf4hz3TeSiJTYoaW1/mT6Iysumkm9vUObKK1qK++XCnV1J0j1cKJlophzCMZKMdGvp5HwmscK/ffOWRmTSjY5osTDgilxAEzgMLnUrq4bBGJoMpkSGA/cu6gAvapVcpgEw29SLQXlcpPobFO3vtxbqqMUs1/b+43+g0A59cFDROERYj8yG KlsECljL CuALeLOnvzgyFyLImx9qBP1YcG9CxfhOHG1mdIpELjI+1WI9rOEZbCBTMvDJblHqBsBtAYpC7rsIQqnmM8Au68cZVY1EqQD2dk4YlTNmM3Z4XAbVLKLico111AqFpEUBGI+wTHeC1d0XDxSKaxAVrA59TRFEDgueC+Nr6 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: Some architectures can handle different methods for determining page access count. We may want to do architecture-specific tasks reclassifying generation temperature etc during aging for such architecture. Add an arch hook to support that. Signed-off-by: Aneesh Kumar K.V --- include/linux/page_aging.h | 14 +++++++++++++- mm/vmscan.c | 8 +++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/include/linux/page_aging.h b/include/linux/page_aging.h index ab77f4578916..d7c63ce0d824 100644 --- a/include/linux/page_aging.h +++ b/include/linux/page_aging.h @@ -11,6 +11,10 @@ static inline bool arch_supports_page_access_count(void) #endif #ifdef CONFIG_LRU_GEN +bool __try_to_inc_max_seq(struct lruvec *lruvec, + unsigned long max_seq, int scan_priority, + bool can_swap, bool force_scan); + #ifndef arch_get_lru_gen_seq static inline unsigned long arch_get_lru_gen_seq(struct lruvec *lruvec, struct folio *folio) { @@ -19,8 +23,16 @@ static inline unsigned long arch_get_lru_gen_seq(struct lruvec *lruvec, struct f return lruvec->lrugen.min_seq[type]; } #endif -#endif /* CONFIG_LRU_GEN */ +#ifndef arch_try_to_inc_max_seq +static inline bool arch_try_to_inc_max_seq(struct lruvec *lruvec, unsigned long max_seq, + int scan_priority, bool can_swap, bool force_scan) +{ + return __try_to_inc_max_seq(lruvec, max_seq, scan_priority, can_swap, force_scan); +} +#endif + +#endif /* CONFIG_LRU_GEN */ #endif diff --git a/mm/vmscan.c b/mm/vmscan.c index 518d1482f6ab..c8b98201f0b0 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4536,7 +4536,13 @@ bool __try_to_inc_max_seq(struct lruvec *lruvec, static bool try_to_inc_max_seq(struct lruvec *lruvec, unsigned long max_seq, int scan_priority, bool can_swap, bool force_scan) { - return __try_to_inc_max_seq(lruvec, max_seq, scan_priority, can_swap, force_scan); + if (arch_supports_page_access_count()) + return arch_try_to_inc_max_seq(lruvec, max_seq, + scan_priority, can_swap, + force_scan); + else + return __try_to_inc_max_seq(lruvec, max_seq, + scan_priority, can_swap, force_scan); } #endif