diff mbox series

[v2,1/2] arm64/hugetlb: Use ptep_get() to get the pte value of a huge page

Message ID d3d60680508486ecb48ae639cfd3911009275710.1652411252.git.baolin.wang@linux.alibaba.com (mailing list archive)
State New
Headers show
Series Implement arm64 specific huge_ptep_get() | expand

Commit Message

Baolin Wang May 13, 2022, 3:37 a.m. UTC
The original huge_ptep_get() on ARM64 is just a wrapper of ptep_get(),
which will not take into account any contig-PTEs dirty and access bits.
Meanwhile we will implement a new ARM64-specific huge_ptep_get()
interface in following patch, which will take into account any contig-PTEs
dirty and access bits. To keep the same efficient logics to get the pte
value, change to use ptep_get() as a preparation.

Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
---
 arch/arm64/mm/hugetlbpage.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Anshuman Khandual May 13, 2022, 10:50 a.m. UTC | #1
On 5/13/22 09:07, Baolin Wang wrote:
> The original huge_ptep_get() on ARM64 is just a wrapper of ptep_get(),

Right, as arm64 does not enable __HAVE_ARCH_HUGE_PTEP_GET.

> which will not take into account any contig-PTEs dirty and access bits.

As expected being operating on a single table entry.

> Meanwhile we will implement a new ARM64-specific huge_ptep_get()
> interface in following patch, which will take into account any contig-PTEs
> dirty and access bits. To keep the same efficient logics to get the pte

s/logics/logic

> value, change to use ptep_get() as a preparation.
> 
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> Reviewed-by: Muchun Song <songmuchun@bytedance.com>

LGTM

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

> ---
>  arch/arm64/mm/hugetlbpage.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> index 30f5b76..9553851 100644
> --- a/arch/arm64/mm/hugetlbpage.c
> +++ b/arch/arm64/mm/hugetlbpage.c
> @@ -172,7 +172,7 @@ static pte_t get_clear_contig(struct mm_struct *mm,
>  			     unsigned long pgsize,
>  			     unsigned long ncontig)
>  {
> -	pte_t orig_pte = huge_ptep_get(ptep);
> +	pte_t orig_pte = ptep_get(ptep);
>  	unsigned long i;
>  
>  	for (i = 0; i < ncontig; i++, addr += pgsize, ptep++) {
> @@ -379,7 +379,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
>  {
>  	int ncontig;
>  	size_t pgsize;
> -	pte_t orig_pte = huge_ptep_get(ptep);
> +	pte_t orig_pte = ptep_get(ptep);
>  
>  	if (!pte_cont(orig_pte))
>  		return ptep_get_and_clear(mm, addr, ptep);
> @@ -402,11 +402,11 @@ static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig)
>  {
>  	int i;
>  
> -	if (pte_write(pte) != pte_write(huge_ptep_get(ptep)))
> +	if (pte_write(pte) != pte_write(ptep_get(ptep)))
>  		return 1;
>  
>  	for (i = 0; i < ncontig; i++) {
> -		pte_t orig_pte = huge_ptep_get(ptep + i);
> +		pte_t orig_pte = ptep_get(ptep + i);
>  
>  		if (pte_dirty(pte) != pte_dirty(orig_pte))
>  			return 1;
Baolin Wang May 14, 2022, 1:42 a.m. UTC | #2
On 5/13/2022 6:50 PM, Anshuman Khandual wrote:
> 
> 
> On 5/13/22 09:07, Baolin Wang wrote:
>> The original huge_ptep_get() on ARM64 is just a wrapper of ptep_get(),
> 
> Right, as arm64 does not enable __HAVE_ARCH_HUGE_PTEP_GET.
> 
>> which will not take into account any contig-PTEs dirty and access bits.
> 
> As expected being operating on a single table entry.
> 
>> Meanwhile we will implement a new ARM64-specific huge_ptep_get()
>> interface in following patch, which will take into account any contig-PTEs
>> dirty and access bits. To keep the same efficient logics to get the pte
> 
> s/logics/logic

Will fix.

> 
>> value, change to use ptep_get() as a preparation.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
>> Reviewed-by: Muchun Song <songmuchun@bytedance.com>
> 
> LGTM
> 
> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

Thanks.
diff mbox series

Patch

diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index 30f5b76..9553851 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -172,7 +172,7 @@  static pte_t get_clear_contig(struct mm_struct *mm,
 			     unsigned long pgsize,
 			     unsigned long ncontig)
 {
-	pte_t orig_pte = huge_ptep_get(ptep);
+	pte_t orig_pte = ptep_get(ptep);
 	unsigned long i;
 
 	for (i = 0; i < ncontig; i++, addr += pgsize, ptep++) {
@@ -379,7 +379,7 @@  pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
 {
 	int ncontig;
 	size_t pgsize;
-	pte_t orig_pte = huge_ptep_get(ptep);
+	pte_t orig_pte = ptep_get(ptep);
 
 	if (!pte_cont(orig_pte))
 		return ptep_get_and_clear(mm, addr, ptep);
@@ -402,11 +402,11 @@  static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig)
 {
 	int i;
 
-	if (pte_write(pte) != pte_write(huge_ptep_get(ptep)))
+	if (pte_write(pte) != pte_write(ptep_get(ptep)))
 		return 1;
 
 	for (i = 0; i < ncontig; i++) {
-		pte_t orig_pte = huge_ptep_get(ptep + i);
+		pte_t orig_pte = ptep_get(ptep + i);
 
 		if (pte_dirty(pte) != pte_dirty(orig_pte))
 			return 1;