From nobody Sun Feb 8 11:07:11 2026 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) (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 B7CC0312835 for ; Wed, 24 Dec 2025 10:54:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.110 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766573672; cv=none; b=GhSr1PWYB/vG/yoaEy+iULPLDkThPZlfmT2oSSDKjw6qFZ7YwDnmqGKiIwjSArurHWYNdeoowZAdfyXgKuJg/2YZJxsUN/MXoh8nv2pmPs4L9PxMDadM14Rjf/xNeHmldrUG6ls1qXKVXAbpbRSDIyYgEqaQXiqXwLyiE5U7ABg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766573672; c=relaxed/simple; bh=kzBeARnd4yk3S9XECoDFfe1kKZSUuw4ECouUrvQPgSI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O30qMJ6nh878juGr/bgkxuPORwgAc0q9xo9j9n/BFMXyLnaiR5gbBaWk0q8vlWWwNNJvCydHZqOrtc8T44rpMTmyLxebFBn4gPrImfZKoQGynKX7RFze0xAiQOKRbTnE8DxBMVxtPrdJIV3E1+okHPfO9eh/CQNAtaz5nZjqML8= 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=oE3diJxp; arc=none smtp.client-ip=115.124.30.110 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="oE3diJxp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1766573659; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=zj162aZxQBEU+UIjJS9+a4lH3G+iwLeQyL/18BsRVfw=; b=oE3diJxpjO9RuM+V4YbtxWMeswDXMZx4vdQW3JUycN/x3pC2mCQ0KKPzelk7MwEIMQYIsWqcCVeBRQbThxvEsekHKrMaUVdojklCsekgV0GFQVaxM4dBKnLJ0LiInpKfxg2axk4DKtcWMLO032kP9aj0yWChyjdME4m77yR6wcM= Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0Wvb6GVT_1766573657 cluster:ay36) by smtp.aliyun-inc.com; Wed, 24 Dec 2025 18:54:18 +0800 From: Baolin Wang To: baolin.wang@linux.alibaba.com Cc: Liam.Howlett@oracle.com, akpm@linux-foundation.org, baohua@kernel.org, catalin.marinas@arm.com, david@kernel.org, dev.jain@arm.com, harry.yoo@oracle.com, jannh@google.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lorenzo.stoakes@oracle.com, mhocko@suse.com, riel@surriel.com, rppt@kernel.org, ryan.roberts@arm.com, surenb@google.com, vbabka@suse.cz, will@kernel.org, willy@infradead.org Subject: [PATCH] arm64: mm: fix passing the incorrect 'CONT_PTES' for non-batched APIs Date: Wed, 24 Dec 2025 18:54:07 +0800 Message-ID: <38f3d9fbd486bdd75874a833a24a8c704b6b5a95.1766573044.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <3b427d9010a6d52f2b91342760f12be097d21cf6.1766455378.git.baolin.wang@linux.alibaba.com> References: <3b427d9010a6d52f2b91342760f12be097d21cf6.1766455378.git.baolin.wang@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since contpte_test_and_clear_young_ptes() and contpte_clear_flush_young_ptes have already performed CONT_PTE_SIZE alignment and will clear the young fl= ag for the entire cont block, Their non-batched callers do not need to pass in 'CONT_PTES' to specify the cont block range. Otherwise, it may exceed the range of a single cont block for the non-batched cases. Signed-off-by: Baolin Wang --- Hi Andrew, As I conducted more tests, I found that the ptep_test_and_clear_young() ope= ration may clear the young flag beyond a single cont block range, causing issues. Please fold this fixup into this patch to solve this issue. Thanks. --- arch/arm64/include/asm/pgtable.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgta= ble.h index d5fbe72e820a..5e9ff16146c3 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -1823,7 +1823,7 @@ static inline int ptep_test_and_clear_young(struct vm= _area_struct *vma, if (likely(!pte_valid_cont(orig_pte))) return __ptep_test_and_clear_young(vma, addr, ptep); =20 - return contpte_test_and_clear_young_ptes(vma, addr, ptep, CONT_PTES); + return contpte_test_and_clear_young_ptes(vma, addr, ptep, 1); } =20 #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH @@ -1835,7 +1835,7 @@ static inline int ptep_clear_flush_young(struct vm_ar= ea_struct *vma, if (likely(!pte_valid_cont(orig_pte))) return __ptep_clear_flush_young(vma, addr, ptep); =20 - return contpte_clear_flush_young_ptes(vma, addr, ptep, CONT_PTES); + return contpte_clear_flush_young_ptes(vma, addr, ptep, 1); } =20 #define wrprotect_ptes wrprotect_ptes --=20 2.47.3