Skip to contentSkip to conversation

mm: use proper PTE accessor in move_ptes()

PATCH Applied Alexander Gordeev 3 participants 6 messages Jul 20 – Jul 30

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: use proper PTE accessor in move_ptes()

Follow the pattern established by commit c33c794828f2 ("mm: ptep_get() conversion") and use the proper PTE accessor instead of a direct pointer dereference.

Fixes b36b701bbcd9 ("mm: expose abnormal new_pte during move_ptes")
---
 mm/mremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mremap.c +1 -1
index 0dfe3de39ccc..e99b19a9850b 100644
@@ -264,7 +264,7 @@ static int move_ptes(struct pagetable_move_control *pmc,
 
 	for (; old_addr < old_end; old_ptep += nr_ptes, old_addr += nr_ptes * PAGE_SIZE,
 		new_ptep += nr_ptes, new_addr += nr_ptes * PAGE_SIZE) {
-		VM_WARN_ON_ONCE(!pte_none(*new_ptep));
+		VM_WARN_ON_ONCE(!pte_none(ptep_get(new_ptep)));
 
 		nr_ptes = 1;
 		max_nr_ptes = (old_end - old_addr) >> PAGE_SHIFT;
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Alexander Gordeev

Follow the pattern established by commit c33c794828f2 ("mm: ptep_get() conversion") and use the proper PTE accessor instead of a direct pointer dereference.

Fixes b36b701bbcd9 ("mm: expose abnormal new_pte during move_ptes")
---
 mm/mremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mremap.c +0 -0
index 0dfe3de39ccc..e99b19a9850b 100644

mm/mremap.c static int move_ptes(struct pagetable_move_control *pmc, · line 267

Quoted 5 lines
mm/mremap.c +1 -1
@@ -264,7 +264,7 @@ static int move_ptes(struct pagetable_move_control *pmc,
 
 	for (; old_addr < old_end; old_ptep += nr_ptes, old_addr += nr_ptes * PAGE_SIZE,
 		new_ptep += nr_ptes, new_addr += nr_ptes * PAGE_SIZE) {
-		VM_WARN_ON_ONCE(!pte_none(*new_ptep));
+		VM_WARN_ON_ONCE(!pte_none(ptep_get(new_ptep)));

I'd the same patch in my RFC branch. Hence:

Quoted 3 lines
mm/mremap.c +0 -0
 		nr_ptes = 1;
 		max_nr_ptes = (old_end - old_addr) >> PAGE_SHIFT;
Acked-by on v1 1/1
#2 lore raw
In reply to Alexander Gordeev
Quoted 15 lines · Alexander Gordeev

Follow the pattern established by commit c33c794828f2 ("mm: ptep_get() conversion") and use the proper PTE accessor instead of a direct pointer dereference.

Fixes b36b701bbcd9 ("mm: expose abnormal new_pte during move_ptes")
---
 mm/mremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mremap.c +0 -0
index 0dfe3de39ccc..e99b19a9850b 100644

mm/mremap.c static int move_ptes(struct pagetable_move_control *pmc, · line 270

Quoted 8 lines
mm/mremap.c +1 -1
@@ -264,7 +264,7 @@ static int move_ptes(struct pagetable_move_control *pmc,
 
 	for (; old_addr < old_end; old_ptep += nr_ptes, old_addr += nr_ptes * PAGE_SIZE,
 		new_ptep += nr_ptes, new_addr += nr_ptes * PAGE_SIZE) {
-		VM_WARN_ON_ONCE(!pte_none(*new_ptep));
+		VM_WARN_ON_ONCE(!pte_none(ptep_get(new_ptep)));
 
 		nr_ptes = 1;
 		max_nr_ptes = (old_end - old_addr) >> PAGE_SHIFT;
Signature · 3 lines
Cheers,

David
#3 lore raw
Quoted 22 lines · David Hildenbrand (Arm)
Quoted 21 lines · Alexander Gordeev

Follow the pattern established by commit c33c794828f2 ("mm: ptep_get() conversion") and use the proper PTE accessor instead of a direct pointer dereference.

Fixes b36b701bbcd9 ("mm: expose abnormal new_pte during move_ptes")
---
 mm/mremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mremap.c +1 -1
index 0dfe3de39ccc..e99b19a9850b 100644
@@ -264,7 +264,7 @@ static int move_ptes(struct pagetable_move_control *pmc,
 
 	for (; old_addr < old_end; old_ptep += nr_ptes, old_addr += nr_ptes * PAGE_SIZE,
 		new_ptep += nr_ptes, new_addr += nr_ptes * PAGE_SIZE) {
-		VM_WARN_ON_ONCE(!pte_none(*new_ptep));
+		VM_WARN_ON_ONCE(!pte_none(ptep_get(new_ptep)));
 
Quoted 5 lines

mm/mremap.c static int move_ptes(struct pagetable_move_control *pmc, · line 270

Quoted 2 lines
mm/mremap.c +0 -0
 		nr_ptes = 1;
 		max_nr_ptes = (old_end - old_addr) >> PAGE_SHIFT;

Ah, but I think we should drop the Fixes: tag, or am I missing something?

Signature · 3 lines
Cheers,

David
#4 lore raw
Quoted 23 lines · David Hildenbrand (Arm)
Quoted 22 lines · David Hildenbrand (Arm)
Quoted 21 lines · Alexander Gordeev

Follow the pattern established by commit c33c794828f2 ("mm: ptep_get() conversion") and use the proper PTE accessor instead of a direct pointer dereference.

Fixes b36b701bbcd9 ("mm: expose abnormal new_pte during move_ptes")
---
 mm/mremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mremap.c +1 -1
index 0dfe3de39ccc..e99b19a9850b 100644
@@ -264,7 +264,7 @@ static int move_ptes(struct pagetable_move_control *pmc,
 
 	for (; old_addr < old_end; old_ptep += nr_ptes, old_addr += nr_ptes * PAGE_SIZE,
 		new_ptep += nr_ptes, new_addr += nr_ptes * PAGE_SIZE) {
-		VM_WARN_ON_ONCE(!pte_none(*new_ptep));
+		VM_WARN_ON_ONCE(!pte_none(ptep_get(new_ptep)));
 
Quoted 7 lines
Quoted 5 lines

mm/mremap.c static int move_ptes(struct pagetable_move_control *pmc, · line 270

Quoted 2 lines
mm/mremap.c +0 -0
 		nr_ptes = 1;
 		max_nr_ptes = (old_end - old_addr) >> PAGE_SHIFT;

Ah, but I think we should drop the Fixes: tag, or am I missing something?

No, you do not. I confused it with ptep_get_lockless(), so no bugfix here. Should I send v2?

Quoted 4 lines
Signature · 3 lines
Cheers,

David

Thanks!

#5 lore raw
Quoted 10 lines · Alexander Gordeev
Quoted 6 lines · David Hildenbrand (Arm)
Quoted 3 lines · David Hildenbrand (Arm)

Ah, but I think we should drop the Fixes: tag, or am I missing something?

No, you do not. I confused it with ptep_get_lockless(), so no bugfix here. Should I send v2?

I assume Andrew would fixup when applying.

But looks like you missed to CC him? So better send a v1 to make his life easier.

Signature · 3 lines
Cheers,

David