From nobody Mon Apr 6 09:19:39 2026 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 7D192372669; Sat, 21 Mar 2026 06:43:22 +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=1774075405; cv=none; b=SUyYcA3OcOavXTjasQdBlRkiF6OaEVwRPEnzzCe4IyhlPQv8SrpkiDT1Q0YIrY4NkChWQ9PrzxSkCBwIt2icBABtOifAaC6VIBdCYJVFLgxcfGvN73Tn68yNagfoQucWK/EGhpMDIiM3bD4tNE5GZEp1LedDlNqnpy5kBIvouxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774075405; c=relaxed/simple; bh=n0AMV+0L064JNU3b1Caw+EwMfgEEiZWnpVwdNOc/TyY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nY3VqDM2Um0hI8NkXUUl55ilK+o09VczLgTRJrE4+3AlRwdAPxk/woJ1AFFkMQRsKLDEreDi5YSiuvgJlY9TKeNdcyWvJlOlVnDQyqYwXJj0rBmzcywduNQT/4hrQv1R9lE0rD0VIuOjt4vp7cFzwuCpMhurDhVam9Yiqp9ya70= 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=ciR8wxp1; 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="ciR8wxp1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1774075393; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=r38DJ++ZDt9VMP3Jb2vV9BEVsnvjTIjo6yUFQQjknaQ=; b=ciR8wxp1L55qp7wWKkasBB2SM5wzB/RH6BiZwovwz3tLv+pw2we/PneJsDCAxnrAlPJAP2xhgvA2WhT+BNZjytMAfMOoGfzbhsqVBrL6JeX73Ro2Tz+Dte9CMreaLTqT5lPjbeBCaqasLPRg0EpgcTzy7Kjrj8rSiVBxMQ52ijQ= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R671e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam011083073210;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0X.O98xZ_1774075391; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X.O98xZ_1774075391 cluster:ay36) by smtp.aliyun-inc.com; Sat, 21 Mar 2026 14:43:12 +0800 From: Baolin Wang To: akpm@linux-foundation.org, david@kernel.org Cc: ljs@kernel.org, Liam.Howlett@oracle.com, vbabka@kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, baolin.wang@linux.alibaba.com, linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org (open), linux-kernel@vger.kernel.org Subject: [PATCH v2 4/6] mm: change to return bool for pmdp_clear_flush_young() Date: Sat, 21 Mar 2026 14:42:52 +0800 Message-ID: X-Mailer: git-send-email 2.47.3 In-Reply-To: References: 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" The pmdp_clear_flush_young() is used to clear the young flag and flush the TLB, returning whether the young flag was set for this PMD entry. Change the return type to bool to make the intention clearer. Reviewed-by: Lorenzo Stoakes (Oracle) Signed-off-by: Baolin Wang --- arch/s390/include/asm/pgtable.h | 4 ++-- arch/x86/include/asm/pgtable.h | 4 ++-- arch/x86/mm/pgtable.c | 6 +++--- include/linux/pgtable.h | 10 +++++----- mm/pgtable-generic.c | 7 ++++--- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtabl= e.h index 87a5082da28e..40a6fb19dd1d 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h @@ -1693,8 +1693,8 @@ static inline bool pmdp_test_and_clear_young(struct v= m_area_struct *vma, } =20 #define __HAVE_ARCH_PMDP_CLEAR_YOUNG_FLUSH -static inline int pmdp_clear_flush_young(struct vm_area_struct *vma, - unsigned long addr, pmd_t *pmdp) +static inline bool pmdp_clear_flush_young(struct vm_area_struct *vma, + unsigned long addr, pmd_t *pmdp) { VM_BUG_ON(addr & ~HPAGE_MASK); return pmdp_test_and_clear_young(vma, addr, pmdp); diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index ba867bac6096..6c8f2b17d3f9 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1301,8 +1301,8 @@ extern int pudp_test_and_clear_young(struct vm_area_s= truct *vma, unsigned long addr, pud_t *pudp); =20 #define __HAVE_ARCH_PMDP_CLEAR_YOUNG_FLUSH -extern int pmdp_clear_flush_young(struct vm_area_struct *vma, - unsigned long address, pmd_t *pmdp); +bool pmdp_clear_flush_young(struct vm_area_struct *vma, + unsigned long address, pmd_t *pmdp); =20 =20 #define __HAVE_ARCH_PMDP_HUGE_GET_AND_CLEAR diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index b09e8c5dadf9..fc1c996c5b2d 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -503,10 +503,10 @@ bool ptep_clear_flush_young(struct vm_area_struct *vm= a, } =20 #ifdef CONFIG_TRANSPARENT_HUGEPAGE -int pmdp_clear_flush_young(struct vm_area_struct *vma, - unsigned long address, pmd_t *pmdp) +bool pmdp_clear_flush_young(struct vm_area_struct *vma, + unsigned long address, pmd_t *pmdp) { - int young; + bool young; =20 VM_BUG_ON(address & ~HPAGE_PMD_MASK); =20 diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 6db900a5d38b..cdd68ed3ae1a 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -536,18 +536,18 @@ bool ptep_clear_flush_young(struct vm_area_struct *vm= a, =20 #ifndef __HAVE_ARCH_PMDP_CLEAR_YOUNG_FLUSH #ifdef CONFIG_TRANSPARENT_HUGEPAGE -extern int pmdp_clear_flush_young(struct vm_area_struct *vma, - unsigned long address, pmd_t *pmdp); +bool pmdp_clear_flush_young(struct vm_area_struct *vma, + unsigned long address, pmd_t *pmdp); #else /* * Despite relevant to THP only, this API is called from generic rmap code * under PageTransHuge(), hence needs a dummy implementation for !THP */ -static inline int pmdp_clear_flush_young(struct vm_area_struct *vma, - unsigned long address, pmd_t *pmdp) +static inline bool pmdp_clear_flush_young(struct vm_area_struct *vma, + unsigned long address, pmd_t *pmdp) { BUILD_BUG(); - return 0; + return false; } #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #endif diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index db0ee918b08a..b91b1a98029c 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c @@ -124,10 +124,11 @@ int pmdp_set_access_flags(struct vm_area_struct *vma, #endif =20 #ifndef __HAVE_ARCH_PMDP_CLEAR_YOUNG_FLUSH -int pmdp_clear_flush_young(struct vm_area_struct *vma, - unsigned long address, pmd_t *pmdp) +bool pmdp_clear_flush_young(struct vm_area_struct *vma, + unsigned long address, pmd_t *pmdp) { - int young; + bool young; + VM_BUG_ON(address & ~HPAGE_PMD_MASK); young =3D pmdp_test_and_clear_young(vma, address, pmdp); if (young) --=20 2.47.3