From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8AEF2DBF75 for ; Thu, 26 Mar 2026 01:48:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.113 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774489684; cv=none; b=bAazpPuIRvj/638utoQCHUo7YIfAwaKycnb/goL7oRtc7Nc2Bfn9v0CqJ1DjblACSQmuJX8R1+mBb2y3Pcz0V5ZFc+yZHQ+ppyqofFgRSkNqnXL0tQRFLDerPis/V4NCcHUd4WGwZIik6bSzunmUQd56wn5b8zPM+KE7JgZIYTw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774489684; c=relaxed/simple; bh=83DS6/9+XLWgDbkgOA65XsxFC/YELqw/59MIKvY6PO4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EbMNj+D91JPailmYhFOPHdunfXgwI1OZHqLJAX+DC2SmqsSKAl8qCTgk7zie2KMQfnq7Ke/5ts2yoPZgAHm/AdQM8ghd1ApWKNXZEvZfKYeqWD0AkIM82y6LmxDeOEAda35Xb77HgeMgmUXQMO2TJIzdWcrTAGkchCchgoj1fCA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=EF3koCnK; arc=none smtp.client-ip=115.124.30.113 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="EF3koCnK" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1774489674; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=H8uD3fXoJUVKVQlQPb1UgplQm2Umx6AyBtREGpInkaM=; b=EF3koCnKfebTyiOrU7IFleaG4W9jjVjbGQmJDFXmKOkOzcWNcRTOlbdk9tP4DejgcWMD3/aIJnpTjElLxoEF4wTDGQFxaaF5SJUL2q1qPVo+kQRnHpcFnYVNtryhjDA64kQIc8ot3HDG5cGERsupr2Lsex7yJNg24mT+JuBf95o= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037026112;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0X.jfTBI_1774489671; Received: from 30.74.144.123(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X.jfTBI_1774489671 cluster:ay36) by smtp.aliyun-inc.com; Thu, 26 Mar 2026 09:47:52 +0800 Message-ID: Date: Thu, 26 Mar 2026 09:47:51 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 1/5] mm: rmap: support batched checks of the references for large folios To: "Lorenzo Stoakes (Oracle)" , "David Hildenbrand (Arm)" Cc: Barry Song <21cnbao@gmail.com>, akpm@linux-foundation.org, catalin.marinas@arm.com, will@kernel.org, lorenzo.stoakes@oracle.com, ryan.roberts@arm.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, riel@surriel.com, harry.yoo@oracle.com, jannh@google.com, willy@infradead.org, dev.jain@arm.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <12132694536834262062d1fb304f8f8a064b6750.1770645603.git.baolin.wang@linux.alibaba.com> <43831628-a00f-4292-9797-cb96a029bb00@kernel.org> <86f611cb-1292-44e4-b629-6503135d33ca@kernel.org> From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 3/25/26 11:06 PM, Lorenzo Stoakes (Oracle) wrote: > On Wed, Mar 25, 2026 at 03:58:36PM +0100, David Hildenbrand (Arm) wrote: >> On 3/25/26 15:36, Lorenzo Stoakes (Oracle) wrote: >>> On Mon, Mar 16, 2026 at 03:15:18PM +0100, David Hildenbrand (Arm) wrote: >>>> On 3/16/26 07:25, Baolin Wang wrote: >>>>> >>>>> >>>>> >>>>> Sure. However, after investigating RISC‑V and x86, I found that >>>>> ptep_clear_flush_young() does not flush the TLB on these architectures: >>>>> >>>>> int ptep_clear_flush_young(struct vm_area_struct *vma, >>>>>                unsigned long address, pte_t *ptep) >>>>> { >>>>>     /* >>>>>      * On x86 CPUs, clearing the accessed bit without a TLB flush >>>>>      * doesn't cause data corruption. [ It could cause incorrect >>>>>      * page aging and the (mistaken) reclaim of hot pages, but the >>>>>      * chance of that should be relatively low. ] >>>>>      * >>>>>      * So as a performance optimization don't flush the TLB when >>>>>      * clearing the accessed bit, it will eventually be flushed by >>>>>      * a context switch or a VM operation anyway. [ In the rare >>>>>      * event of it not getting flushed for a long time the delay >>>>>      * shouldn't really matter because there's no real memory >>>>>      * pressure for swapout to react to. ] >>>>>      */ >>>>>     return ptep_test_and_clear_young(vma, address, ptep); >>>>> } >>>> >>>> You'd probably want an arch helper then, that tells you whether >>>> a flush_tlb_range() after ptep_test_and_clear_young() is required. >>>> >>>> Or some special flush_tlb_range() helper. >>>> >>>> I agree that it requires more work. (Sorry, David. I forgot to reply to your email because I've had a lot to sort out recently.) Rather than adding more arch helpers (we already have plenty for the young flag check), I think we should try removing the TLB flush, as I mentioned to Barry[1]. MGLRU reclaim already skips the TLB flush, and it seems to work fine. What do you think? Here are our previous attempts to remove the TLB flush: My patch: https://lkml.org/lkml/2023/10/24/533 Barry's patch: https://lore.kernel.org/lkml/20220617070555.344368-1-21cnbao@gmail.com/ [1] https://lore.kernel.org/all/6bdc4b03-9631-4717-a3fa-2785a7930aba@linux.alibaba.com/ >>> Sorry unclear here - does the series need more work or does a follow up patch >>> need more work? >> >> Follow up! > > Ok good as in mm-stable now. Sadly means I don't get to review it but there we > go. Actually this patchset has already been merged upstream:)