From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) (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 EE07723507B for ; Tue, 10 Feb 2026 00:39:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.132 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770683982; cv=none; b=Xl8x81lE1z84gHrNyCp3CX9WMxwI3hA8ksatE0v9Xy+D9SXGdLNsnETl2hDkQge6QRTEml/cjLssFTmvKLvDHiuHD7id1J3LRlFTYGwfY2dtG6b9Tf57WiDiK/La/hxsUqZxoMVzmJKgoQ2FSZw6G0DipImRnS3x8aEr2Qnr9cA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770683982; c=relaxed/simple; bh=QaY3DSWPDGeWjhZmPSVQSYp3500v23cxVOaMbB5j9yA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TAWf5Vf4ZAeisAOd7yeP8B5MHko+G3j0Dy78RCXJBLJ3vOmk6GqtI8ZD0iduBGx2jYqap1dhOf/XhFYIYcdqbJGjDUqINB4eMrqu1spXCoNFwGnjNoXORbf102JfHAHQQajF72qpGSRTe0MpO9XvndikzOPlJbZTL7ykmRZOzOE= 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=xkkAwuUO; arc=none smtp.client-ip=115.124.30.132 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="xkkAwuUO" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1770683978; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=qLzFv/iaTtm6O5tzZ+GpAratMNjp1TNVZjLH5IvnkwY=; b=xkkAwuUOCWb0HtaYj3FZjc+9UyDITjc7u0w4eY++55f2XfizR6Kg63lKeuRRjCRJwtCxJbQRpjceV3zuyar8WU93SrAlZqargE0Y4xmoCTpwtuIU4jHdNAK3KZbCdPbqKybWHHfVmpf2K/rk2No8nagPBTLbEBnTIaLvkFy7WJQ= Received: from 30.74.144.109(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0Wyx2lhG_1770683976 cluster:ay36) by smtp.aliyun-inc.com; Tue, 10 Feb 2026 08:39:36 +0800 Message-ID: <48e27f5e-d47a-4d53-bc64-6c6a22db9180@linux.alibaba.com> Date: Tue, 10 Feb 2026 08:39:35 +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 4/5] arm64: mm: implement the architecture-specific clear_flush_young_ptes() To: "David Hildenbrand (Arm)" , akpm@linux-foundation.org, catalin.marinas@arm.com, will@kernel.org Cc: 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, baohua@kernel.org, dev.jain@arm.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <10f061c9-5c9a-4e8a-8790-a2a68b38ff33@kernel.org> From: Baolin Wang In-Reply-To: <10f061c9-5c9a-4e8a-8790-a2a68b38ff33@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2/9/26 11:30 PM, David Hildenbrand (Arm) wrote: > On 2/9/26 15:07, Baolin Wang wrote: >> Implement the Arm64 architecture-specific clear_flush_young_ptes() to >> enable >> batched checking of young flags and TLB flushing, improving >> performance during >> large folio reclamation. >> >> Performance testing: >> Allocate 10G clean file-backed folios by mmap() in a memory cgroup, >> and try to >> reclaim 8G file-backed folios via the memory.reclaim interface. I can >> observe >> 33% performance improvement on my Arm64 32-core server (and 10%+ >> improvement >> on my X86 machine). Meanwhile, the hotspot folio_check_references() >> dropped >> from approximately 35% to around 5%. >> >> W/o patchset: >> real    0m1.518s >> user    0m0.000s >> sys    0m1.518s >> >> W/ patchset: >> real    0m1.018s >> user    0m0.000s >> sys    0m1.018s >> >> Reviewed-by: Ryan Roberts >> Signed-off-by: Baolin Wang >> --- >>   arch/arm64/include/asm/pgtable.h | 11 +++++++++++ >>   1 file changed, 11 insertions(+) >> >> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/ >> asm/pgtable.h >> index 3dabf5ea17fa..a17eb8a76788 100644 >> --- a/arch/arm64/include/asm/pgtable.h >> +++ b/arch/arm64/include/asm/pgtable.h >> @@ -1838,6 +1838,17 @@ static inline int ptep_clear_flush_young(struct >> vm_area_struct *vma, >>       return contpte_clear_flush_young_ptes(vma, addr, ptep, 1); >>   } >> +#define clear_flush_young_ptes clear_flush_young_ptes >> +static inline int clear_flush_young_ptes(struct vm_area_struct *vma, >> +                     unsigned long addr, pte_t *ptep, >> +                     unsigned int nr) >> +{ >> +    if (likely(nr == 1 && !pte_cont(__ptep_get(ptep)))) > I guess similar cases where we should never end up with non-present ptes > should be updated accordingly. > > ptep_test_and_clear_young(), for example, should never be called on non- > present ptes. Yes. I already adrressed this in my follow-up patchset. > Reviewed-by: David Hildenbrand (Arm) Thanks.