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 42121C433FE for ; Wed, 27 Apr 2022 05:34:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357884AbiD0Fhy (ORCPT ); Wed, 27 Apr 2022 01:37:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240277AbiD0Fhx (ORCPT ); Wed, 27 Apr 2022 01:37:53 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ED1614D9E0; Tue, 26 Apr 2022 22:34:43 -0700 (PDT) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 23R1jrb4016461; Wed, 27 Apr 2022 05:31:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=qvcqSETCnrSsVB/BY/2FeP2hnvOR7fL3OJ1Z/zo8n8Y=; b=k1nI4OI10xALs2/hzr8UhYW9h9IrOmFoU2I5Q/J/BR8YqvpScp6XwQuC2BuMHkrHTl5u IIh3PCTtMf4gF7x1RoVAZX4mOanbC7zafMrFoUViASCe6Vw/R2pXo6wWT7qKnGJ5kzTZ 2/DWGBEQC3dWgsXqnVTnGjBDFeNNNiY91XGL7MOWGV8F9f4NYxHSutfdN96QmicQQcoa CgjgmWI0Kq8z5KvHiYq1442XaiJ4nOL7TGswFnnz6YB+nogLJ7bJDI8VOAV9xoKC6dkq OFafQVpbJ1BWUzBPEWkk5DUVlR0v+VCEv3kLn0T20ZLtcWdZcdlLUVIU5Do1lC7aT5EB vw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3fpvf2ayjd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Apr 2022 05:31:24 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 23R5Qnkr022931; Wed, 27 Apr 2022 05:31:23 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3fpvf2ayhk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Apr 2022 05:31:23 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23R5STgZ009553; Wed, 27 Apr 2022 05:31:20 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06ams.nl.ibm.com with ESMTP id 3fm8qj5dqe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Apr 2022 05:31:20 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23R5VV7a197362 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Apr 2022 05:31:31 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44AE0A405B; Wed, 27 Apr 2022 05:31:18 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9325CA4054; Wed, 27 Apr 2022 05:31:06 +0000 (GMT) Received: from [9.43.50.189] (unknown [9.43.50.189]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 27 Apr 2022 05:31:06 +0000 (GMT) Message-ID: Date: Wed, 27 Apr 2022 11:01:05 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v10 07/14] mm: multi-gen LRU: exploit locality in rmap Content-Language: en-US To: Yu Zhao Cc: Stephen Rothwell , Linux-MM , 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 , "open list:DOCUMENTATION" , linux-kernel , Kernel Page Reclaim v2 , the arch/x86 maintainers , Brian Geffon , Jan Alexander Steffens , Oleksandr Natalenko , Steven Barrett , Suleiman Souhlal , Daniel Byrne , Donald Carr , =?UTF-8?Q?Holger_Hoffst=c3=a4tte?= , Konstantin Kharlamov , Shuang Zhai , Sofia Trinh , Vaibhav Jain References: <20220407031525.2368067-1-yuzhao@google.com> <20220407031525.2368067-8-yuzhao@google.com> <87zgk7xi13.fsf@linux.ibm.com> From: Aneesh Kumar K V In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: wSnKa9i6LJ4CkALAKM198ug-RE1mkUcQ X-Proofpoint-ORIG-GUID: GLXECfseS7nZckMSqJ77FNySoyWBaJ6a 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 clxscore=1015 mlxlogscore=999 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 phishscore=0 mlxscore=0 priorityscore=1501 adultscore=0 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204270036 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/27/22 10:08 AM, Yu Zhao wrote: > On Tue, Apr 26, 2022 at 10:33 PM Aneesh Kumar K.V > wrote: >> >> 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? > > referenced++ is needed because lru_gen_look_around() also clears the > young bit in pvmw.pte. And ptep_clear_flush_young_notify() will return > false unless mmu notifier returns true. should we then use a mmu notifier variant of clear_young in lru_gen_look_around() ? -aneesh 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 47462C433F5 for ; Wed, 27 Apr 2022 05:33:18 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CMY40QyQS7GyD8szLpjSVMfuaNfUpGp82Y4eAyng5NY=; b=yGwuUvMMYC4L7A pWMonXh06Fs9SxWr3CehfXMRNS7XhmuBsPAIRe6yCiI7i4xO4MbguQgMumWBWRGAf3n4fY9y0kk9B Sz2ejGaECbNO1kD1BGQ+2ql1Mf/5UcOANNK0OnaYegM7mIqWgbBrlcvaI1bDkvbogIvk3DVEqBQew jfnSPSpw6u4k7HErhGMRkfqw+xdHvdOp6HqWo16aU8TgnhKVu7wiX44dhPZUejJXqYsD5dpo+13MT /ZAxrKdoBPqPkJgr0VCQxg97m/brNdLkYT5hAcG9HOxzRsUUHBHH6oTY7YXjwt8lhQ81pNPAU1Hq9 gU8FxmOKJyjpzd1d26cA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1njaHH-00HTmp-Lp; Wed, 27 Apr 2022 05:31:51 +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 1njaHF-00HTmJ-05 for linux-arm-kernel@lists.infradead.org; Wed, 27 Apr 2022 05:31:50 +0000 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 23R1jrb4016461; Wed, 27 Apr 2022 05:31:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=qvcqSETCnrSsVB/BY/2FeP2hnvOR7fL3OJ1Z/zo8n8Y=; b=k1nI4OI10xALs2/hzr8UhYW9h9IrOmFoU2I5Q/J/BR8YqvpScp6XwQuC2BuMHkrHTl5u IIh3PCTtMf4gF7x1RoVAZX4mOanbC7zafMrFoUViASCe6Vw/R2pXo6wWT7qKnGJ5kzTZ 2/DWGBEQC3dWgsXqnVTnGjBDFeNNNiY91XGL7MOWGV8F9f4NYxHSutfdN96QmicQQcoa CgjgmWI0Kq8z5KvHiYq1442XaiJ4nOL7TGswFnnz6YB+nogLJ7bJDI8VOAV9xoKC6dkq OFafQVpbJ1BWUzBPEWkk5DUVlR0v+VCEv3kLn0T20ZLtcWdZcdlLUVIU5Do1lC7aT5EB vw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3fpvf2ayjd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Apr 2022 05:31:24 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 23R5Qnkr022931; Wed, 27 Apr 2022 05:31:23 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3fpvf2ayhk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Apr 2022 05:31:23 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23R5STgZ009553; Wed, 27 Apr 2022 05:31:20 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06ams.nl.ibm.com with ESMTP id 3fm8qj5dqe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Apr 2022 05:31:20 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23R5VV7a197362 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Apr 2022 05:31:31 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44AE0A405B; Wed, 27 Apr 2022 05:31:18 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9325CA4054; Wed, 27 Apr 2022 05:31:06 +0000 (GMT) Received: from [9.43.50.189] (unknown [9.43.50.189]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 27 Apr 2022 05:31:06 +0000 (GMT) Message-ID: Date: Wed, 27 Apr 2022 11:01:05 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v10 07/14] mm: multi-gen LRU: exploit locality in rmap Content-Language: en-US To: Yu Zhao Cc: Stephen Rothwell , Linux-MM , 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 , "open list:DOCUMENTATION" , linux-kernel , Kernel Page Reclaim v2 , the arch/x86 maintainers , Brian Geffon , Jan Alexander Steffens , Oleksandr Natalenko , Steven Barrett , Suleiman Souhlal , Daniel Byrne , Donald Carr , =?UTF-8?Q?Holger_Hoffst=c3=a4tte?= , Konstantin Kharlamov , Shuang Zhai , Sofia Trinh , Vaibhav Jain References: <20220407031525.2368067-1-yuzhao@google.com> <20220407031525.2368067-8-yuzhao@google.com> <87zgk7xi13.fsf@linux.ibm.com> From: Aneesh Kumar K V In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: wSnKa9i6LJ4CkALAKM198ug-RE1mkUcQ X-Proofpoint-ORIG-GUID: GLXECfseS7nZckMSqJ77FNySoyWBaJ6a 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 clxscore=1015 mlxlogscore=999 lowpriorityscore=0 spamscore=0 malwarescore=0 bulkscore=0 phishscore=0 mlxscore=0 priorityscore=1501 adultscore=0 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204270036 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220426_223149_096863_4928596E X-CRM114-Status: GOOD ( 20.41 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 4/27/22 10:08 AM, Yu Zhao wrote: > On Tue, Apr 26, 2022 at 10:33 PM Aneesh Kumar K.V > wrote: >> >> 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? > > referenced++ is needed because lru_gen_look_around() also clears the > young bit in pvmw.pte. And ptep_clear_flush_young_notify() will return > false unless mmu notifier returns true. should we then use a mmu notifier variant of clear_young in lru_gen_look_around() ? -aneesh _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel