From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC307C433F5 for ; Wed, 27 Apr 2022 04:37:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357705AbiD0EkX (ORCPT ); Wed, 27 Apr 2022 00:40:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345860AbiD0EkT (ORCPT ); Wed, 27 Apr 2022 00:40:19 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 269D21DA50; Tue, 26 Apr 2022 21:37:09 -0700 (PDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 23R2VObw015241; Wed, 27 Apr 2022 04:33:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : in-reply-to : references : date : message-id : mime-version : content-type; s=pp1; bh=P/3XNVpL7lXvtlLB0wtJ1D8fNHMX45H+WNBY47qEjTU=; b=GsnU9himGDTT56UiekzH13DpKpbzyxewZCX9GAjiBcDo2LKHJ0kD3TIkIj5YL4j1gxQN VaGjE6ovtzzuot4pbLprYu9/tOtMPJvqngJTnt/wH3GUU8krFwK7LGIf1eLjYWw0ntJX zuR2TEKmEnfsiL+GzascnA8bi1Nl67hqEC0lNkBLCMZzDZZDiiEVSaiuHsPMXVFa0RFE nd+xB1uP70yVn8uqAvGVD6bQE3/FmplixT7jOKJ9RCz9I1wBBLnTRU5P3e1yQgLnY0DU gCfmoB/6VpL/cV/fWRStACN0pPMCKuqg1tWBFtCgF+UdmQ4UHJOzfyc3/JhWAIWTIG3R 9Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3fpsspvpt8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Apr 2022 04:33:23 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 23R4LGEc013778; Wed, 27 Apr 2022 04:33:22 GMT Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3fpsspvpss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Apr 2022 04:33:22 +0000 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23R4SXFS015709; Wed, 27 Apr 2022 04:33:20 GMT Received: from b03cxnp07027.gho.boulder.ibm.com (b03cxnp07027.gho.boulder.ibm.com [9.17.130.14]) by ppma02wdc.us.ibm.com with ESMTP id 3fm939srwx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Apr 2022 04:33:20 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23R4XJTq25035114 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Apr 2022 04:33:19 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 50390C6057; Wed, 27 Apr 2022 04:33:19 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E7916C6059; Wed, 27 Apr 2022 04:33:02 +0000 (GMT) Received: from skywalker.linux.ibm.com (unknown [9.43.50.189]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 27 Apr 2022 04:33:02 +0000 (GMT) X-Mailer: emacs 29.0.50 (via feedmail 11-beta-1 I) From: "Aneesh Kumar K.V" To: Yu Zhao , Stephen Rothwell , linux-mm@kvack.org Cc: Andi Kleen , Andrew Morton , Barry Song <21cnbao@gmail.com>, Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Johannes Weiner , Jonathan Corbet , Linus Torvalds , Matthew Wilcox , Mel Gorman , Michael Larabel , Michal Hocko , Mike Rapoport , Rik van Riel , Vlastimil Babka , Will Deacon , Ying Huang , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, page-reclaim@google.com, x86@kernel.org, Yu Zhao , Brian Geffon , Jan Alexander Steffens , Oleksandr Natalenko , Steven Barrett , Suleiman Souhlal , Daniel Byrne , Donald Carr , Holger =?utf-8?Q?Hoffst=C3=A4tte?= , Konstantin Kharlamov , Shuang Zhai , Sofia Trinh , Vaibhav Jain Subject: Re: [PATCH v10 07/14] mm: multi-gen LRU: exploit locality in rmap In-Reply-To: <20220407031525.2368067-8-yuzhao@google.com> References: <20220407031525.2368067-1-yuzhao@google.com> <20220407031525.2368067-8-yuzhao@google.com> Date: Wed, 27 Apr 2022 10:02:56 +0530 Message-ID: <87zgk7xi13.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-GUID: gtJPmcWjuPxlyxYBKW51oqDKp_XYDYZP X-Proofpoint-ORIG-GUID: 42FW6whtngg3Q_8U1dckC2WbPYt7lfYG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-27_01,2022-04-26_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 mlxscore=0 phishscore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=774 malwarescore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204270028 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Yu Zhao writes: .... diff --git a/mm/rmap.c b/mm/rmap.c > index fedb82371efe..7cb7ef29088a 100644 > --- a/mm/rmap.c > +++ b/mm/rmap.c > @@ -73,6 +73,7 @@ > #include > #include > #include > +#include > > #include > > @@ -821,6 +822,12 @@ static bool folio_referenced_one(struct folio *folio, > } > > if (pvmw.pte) { > + if (lru_gen_enabled() && pte_young(*pvmw.pte) && > + !(vma->vm_flags & (VM_SEQ_READ | VM_RAND_READ))) { > + lru_gen_look_around(&pvmw); > + referenced++; > + } Is it required to update referenced here? we do that below after clearing the young bit. Or is the goal to identify whether we found any young pte around? > + > if (ptep_clear_flush_young_notify(vma, address, > pvmw.pte)) { > /* From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C62CBC433EF for ; Wed, 27 Apr 2022 04:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wdiQOfhhuoZkS6VVzlBT2g7mkCNUW4spIlcDDxVGr34=; b=2Il/POnHYU1lOy rwx7r+kY1HPrioomm/e3YlF/5xcfq7hClF+UOQ0r/DsHubCR3egxTqv0aihHW7eex+k2l2/GDF1EY 8L2NnTzuZRAuW2RTXSQJCuOuPH36KtUNCxLKqNeAnrCPSVbfPGrQlRd8TjwERRYuq0MdjK916Dl1N WhaaLY/8vH+OqprC2xXCjIFXtwel7/2sz48wQrhZk1o0BSpvIwOVXV4v7g3w5ujm+DhP0oFupzyEU YAnYOZ5jQurwolBaSOKkQXLTQ7J1piYfw/vp1gMpH/pcLeciGqkPeScdn3jqtScHHyNPOAPA9uOgI y1xZiDaYlWpBTM/TZJig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1njZNT-00HOTX-K9; Wed, 27 Apr 2022 04:34:11 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1njZNQ-00HOSw-By for linux-arm-kernel@lists.infradead.org; Wed, 27 Apr 2022 04:34:09 +0000 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 23R2VObw015241; Wed, 27 Apr 2022 04:33:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : in-reply-to : references : date : message-id : mime-version : content-type; s=pp1; bh=P/3XNVpL7lXvtlLB0wtJ1D8fNHMX45H+WNBY47qEjTU=; b=GsnU9himGDTT56UiekzH13DpKpbzyxewZCX9GAjiBcDo2LKHJ0kD3TIkIj5YL4j1gxQN VaGjE6ovtzzuot4pbLprYu9/tOtMPJvqngJTnt/wH3GUU8krFwK7LGIf1eLjYWw0ntJX zuR2TEKmEnfsiL+GzascnA8bi1Nl67hqEC0lNkBLCMZzDZZDiiEVSaiuHsPMXVFa0RFE nd+xB1uP70yVn8uqAvGVD6bQE3/FmplixT7jOKJ9RCz9I1wBBLnTRU5P3e1yQgLnY0DU gCfmoB/6VpL/cV/fWRStACN0pPMCKuqg1tWBFtCgF+UdmQ4UHJOzfyc3/JhWAIWTIG3R 9Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3fpsspvpt8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Apr 2022 04:33:23 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 23R4LGEc013778; Wed, 27 Apr 2022 04:33:22 GMT Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3fpsspvpss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Apr 2022 04:33:22 +0000 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23R4SXFS015709; Wed, 27 Apr 2022 04:33:20 GMT Received: from b03cxnp07027.gho.boulder.ibm.com (b03cxnp07027.gho.boulder.ibm.com [9.17.130.14]) by ppma02wdc.us.ibm.com with ESMTP id 3fm939srwx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Apr 2022 04:33:20 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23R4XJTq25035114 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Apr 2022 04:33:19 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 50390C6057; Wed, 27 Apr 2022 04:33:19 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E7916C6059; Wed, 27 Apr 2022 04:33:02 +0000 (GMT) Received: from skywalker.linux.ibm.com (unknown [9.43.50.189]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 27 Apr 2022 04:33:02 +0000 (GMT) X-Mailer: emacs 29.0.50 (via feedmail 11-beta-1 I) From: "Aneesh Kumar K.V" To: Yu Zhao , Stephen Rothwell , linux-mm@kvack.org Cc: Andi Kleen , Andrew Morton , Barry Song <21cnbao@gmail.com>, Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Johannes Weiner , Jonathan Corbet , Linus Torvalds , Matthew Wilcox , Mel Gorman , Michael Larabel , Michal Hocko , Mike Rapoport , Rik van Riel , Vlastimil Babka , Will Deacon , Ying Huang , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, page-reclaim@google.com, x86@kernel.org, Yu Zhao , Brian Geffon , Jan Alexander Steffens , Oleksandr Natalenko , Steven Barrett , Suleiman Souhlal , Daniel Byrne , Donald Carr , Holger =?utf-8?Q?Hoffst=C3=A4tte?= , Konstantin Kharlamov , Shuang Zhai , Sofia Trinh , Vaibhav Jain Subject: Re: [PATCH v10 07/14] mm: multi-gen LRU: exploit locality in rmap In-Reply-To: <20220407031525.2368067-8-yuzhao@google.com> References: <20220407031525.2368067-1-yuzhao@google.com> <20220407031525.2368067-8-yuzhao@google.com> Date: Wed, 27 Apr 2022 10:02:56 +0530 Message-ID: <87zgk7xi13.fsf@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: gtJPmcWjuPxlyxYBKW51oqDKp_XYDYZP X-Proofpoint-ORIG-GUID: 42FW6whtngg3Q_8U1dckC2WbPYt7lfYG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-27_01,2022-04-26_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 mlxscore=0 phishscore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=774 malwarescore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204270028 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220426_213408_441005_7F9C45D4 X-CRM114-Status: GOOD ( 17.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Yu Zhao writes: .... diff --git a/mm/rmap.c b/mm/rmap.c > index fedb82371efe..7cb7ef29088a 100644 > --- a/mm/rmap.c > +++ b/mm/rmap.c > @@ -73,6 +73,7 @@ > #include > #include > #include > +#include > > #include > > @@ -821,6 +822,12 @@ static bool folio_referenced_one(struct folio *folio, > } > > if (pvmw.pte) { > + if (lru_gen_enabled() && pte_young(*pvmw.pte) && > + !(vma->vm_flags & (VM_SEQ_READ | VM_RAND_READ))) { > + lru_gen_look_around(&pvmw); > + referenced++; > + } Is it required to update referenced here? we do that below after clearing the young bit. Or is the goal to identify whether we found any young pte around? > + > if (ptep_clear_flush_young_notify(vma, address, > pvmw.pte)) { > /* _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel