mm/khugepaged: continue to collapse on SCAN_PMD_NONE
Subsystems (2)
PATCH 1/1 mm/khugepaged: continue to collapse on SCAN_PMD_NONE
SCAN_PMD_NONE means current pmd is empty, but we can still continue collapse next pmd range.
--- mm/khugepaged.c | 1 + 1 file changed, 1 insertion(+)
mm/khugepaged.c +1 -0
@@ -2835,6 +2835,7 @@ int madvise_collapse(struct vm_area_struct *vma, unsigned long start, goto handle_result;/* Whitelisted set of results where continuing OK */ case SCAN_PMD_NULL : +case SCAN_PMD_NONE :case SCAN_PTE_NON_PRESENT :case SCAN_PTE_UFFD_WP :case SCAN_LACK_REFERENCED_PAGE :
Signature · 1 line
2.34.1
Quoted 2 lines · Wei Yang
SCAN_PMD_NONEmeans current pmd is empty, but we can still continue collapse next pmd range.
Right, bailing out of the whole MADV_COLLAPSE request just because we encounter one empty PMD is too strict ...
It makes sense to treat SCAN_PMD_NONE like the other whitelisted cases (e.g., SCAN_PMD_NULL).
Quoted 3 lines
Signed-off-by Wei Yang <[email protected]>---
LGTM.
Quoted 15 lines
mm/khugepaged.c | 1 + 1 file changed, 1 insertion(+)mm/khugepaged.c +1
-0@@ -2835,6 +2835,7 @@ int madvise_collapse(struct vm_area_struct *vma, unsigned long start, goto handle_result;/* Whitelisted set of results where continuing OK */ case SCAN_PMD_NULL : +case SCAN_PMD_NONE :case SCAN_PTE_NON_PRESENT :case SCAN_PTE_UFFD_WP :case SCAN_LACK_REFERENCED_PAGE :
Quoted 12 lines · Lance Yang
Quoted 2 lines · Wei Yang
SCAN_PMD_NONEmeans current pmd is empty, but we can still continue collapse next pmd range.Right, bailing out of the whole
MADV_COLLAPSErequest just because we encounter one empty PMD is too strict ...It makes sense to treat
SCAN_PMD_NONElike the other whitelisted cases (e.g.,SCAN_PMD_NULL).Quoted 1 line
Quoted 7 lines
Quoted 2 lines
Signed-off-by Wei Yang <[email protected]>---
LGTM.
Reviewed-by Lance Yang <[email protected]>
Thanks for the review.
I'm currently evaluating the use of SCAN_NULL versus SCAN_NONE. It seems their usage in the current code is intermixed, and I'm questioning if there's a strong, practical reason to maintain a distinction between these two states. Should they be unified?
Signature · 2 lines
Wei Yang Help you, Help me
Dev Jain
reviewerQuoted 14 lines · Wei Yang
Quoted 13 lines · Lance Yang
Quoted 2 lines · Wei Yang
SCAN_PMD_NONEmeans current pmd is empty, but we can still continue collapse next pmd range.Right, bailing out of the whole
MADV_COLLAPSErequest just because we encounter one empty PMD is too strict ...It makes sense to treat
SCAN_PMD_NONElike the other whitelisted cases (e.g.,SCAN_PMD_NULL).Quoted 2 lines
Signed-off-by Wei Yang <[email protected]>---
LGTM.
Quoted 8 lines
Quoted 2 lines
Reviewed-by Lance Yang <[email protected]>Thanks for the review.
I'm currently evaluating the use of
SCAN_NULLversusSCAN_NONE. It seems their usage in the current code is intermixed, and I'm questioning if there's a strong, practical reason to maintain a distinction between these two states. Should they be unified?
There was some discussion about that in this thread:
https://lore.kernel.org/all/v5ivpub6z2n2uyemlnxgbilzs52ep4lrary7lm7o6axxoneb75@yfacfl5rkzeh/
There are some cleanups mentioned in the thread which you can try if you want :)
Quoted 25 lines · Dev Jain
Quoted 14 lines · Wei Yang
Quoted 13 lines · Lance Yang
Quoted 2 lines · Wei Yang
SCAN_PMD_NONEmeans current pmd is empty, but we can still continue collapse next pmd range.Right, bailing out of the whole
MADV_COLLAPSErequest just because we encounter one empty PMD is too strict ...It makes sense to treat
SCAN_PMD_NONElike the other whitelisted cases (e.g.,SCAN_PMD_NULL).Quoted 2 lines
Signed-off-by Wei Yang <[email protected]>---
LGTM.
Quoted 8 lines
Quoted 2 lines
Reviewed-by Lance Yang <[email protected]>Thanks for the review.
I'm currently evaluating the use of
SCAN_NULLversusSCAN_NONE. It seems their usage in the current code is intermixed, and I'm questioning if there's a strong, practical reason to maintain a distinction between these two states. Should they be unified?
Quoted 6 lines
There was some discussion about that in this thread:
https://lore.kernel.org/all/v5ivpub6z2n2uyemlnxgbilzs52ep4lrary7lm7o6axxoneb75@yfacfl5rkzeh/
There are some cleanups mentioned in the thread which you can try if you want :)
Thanks, will take a look.
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 6 lines · Wei Yang
SCAN_PMD_NONEmeans current pmd is empty, but we can still continue collapse next pmd range.Signed-off-by Wei Yang <[email protected]>---
LGTM
David Hildenbrand (Red Hat)
maintainerQuoted 13 lines · Wei Yang
SCAN_PMD_NONEmeans current pmd is empty, but we can still continue collapse next pmd range.Signed-off-by Wei Yang <[email protected]>--- mm/khugepaged.c | 1 + 1 file changed, 1 insertion(+)mm/khugepaged.c +0
-0
mm/khugepaged.c int madvise_collapse(struct vm_area_struct *vma, unsigned long start, · line 2841
Quoted 7 lines
mm/khugepaged.c +1
-0@@ -2835,6 +2835,7 @@ int madvise_collapse(struct vm_area_struct *vma, unsigned long start, goto handle_result;/* Whitelisted set of results where continuing OK */ case SCAN_PMD_NULL : +case SCAN_PMD_NONE :case SCAN_PTE_NON_PRESENT :case SCAN_PTE_UFFD_WP :case SCAN_LACK_REFERENCED_PAGE :
Looks ok to me.
I am really confused about PMD_NONE vs. PMD_NULL.
Is my understanding correct, hat with your patch we can just merge both into a single NO_PMD_TABLE or sth. like that?
Signature · 3 lines
Cheers David
David Hildenbrand (Red Hat)
maintainerQuoted 24 lines · David Hildenbrand (Red Hat)
Quoted 13 lines · Wei Yang
SCAN_PMD_NONEmeans current pmd is empty, but we can still continue collapse next pmd range.Signed-off-by Wei Yang <[email protected]>--- mm/khugepaged.c | 1 + 1 file changed, 1 insertion(+)mm/khugepaged.c +0
-0mm/khugepaged.c int madvise_collapse(struct vm_area_struct *vma, unsigned long start, · line 2841
Quoted 7 lines
mm/khugepaged.c +1
-0@@ -2835,6 +2835,7 @@ int madvise_collapse(struct vm_area_struct *vma, unsigned long start, goto handle_result;/* Whitelisted set of results where continuing OK */ case SCAN_PMD_NULL : +case SCAN_PMD_NONE :case SCAN_PTE_NON_PRESENT :case SCAN_PTE_UFFD_WP :case SCAN_LACK_REFERENCED_PAGE :Looks ok to me.
Quoted 4 lines
I am really confused about
PMD_NONEvs.PMD_NULL.Is my understanding correct, hat with your patch we can just merge both into a single
NO_PMD_TABLEor sth. like that?
NO_PTE_TABLE, actually
Signature · 3 lines
Cheers David
Quoted 25 lines · David Hildenbrand (Red Hat)
Quoted 24 lines · David Hildenbrand (Red Hat)
Quoted 13 lines · Wei Yang
SCAN_PMD_NONEmeans current pmd is empty, but we can still continue collapse next pmd range.Signed-off-by Wei Yang <[email protected]>--- mm/khugepaged.c | 1 + 1 file changed, 1 insertion(+)mm/khugepaged.c +0
-0mm/khugepaged.c int madvise_collapse(struct vm_area_struct *vma, unsigned long start, · line 2841
Quoted 7 lines
mm/khugepaged.c +1
-0@@ -2835,6 +2835,7 @@ int madvise_collapse(struct vm_area_struct *vma, unsigned long start, goto handle_result;/* Whitelisted set of results where continuing OK */ case SCAN_PMD_NULL : +case SCAN_PMD_NONE :case SCAN_PTE_NON_PRESENT :case SCAN_PTE_UFFD_WP :case SCAN_LACK_REFERENCED_PAGE :Looks ok to me.
Quoted 7 lines
Quoted 4 lines
I am really confused about
PMD_NONEvs.PMD_NULL.Is my understanding correct, hat with your patch we can just merge both into a single
NO_PMD_TABLEor sth. like that?
NO_PTE_TABLE, actually
I am thinking about this too.
If no other objections, I will prepare a v2 with this.
BTW, you prefer merge them directly, or merge on top of this change?
Quoted 4 lines
Signature · 3 lines
Cheers David
Signature · 2 lines
Wei Yang Help you, Help me
David Hildenbrand (Red Hat)
maintainerQuoted 31 lines · Wei Yang
Quoted 30 lines · David Hildenbrand (Red Hat)
Quoted 28 lines · David Hildenbrand (Red Hat)
Quoted 13 lines · Wei Yang
SCAN_PMD_NONEmeans current pmd is empty, but we can still continue collapse next pmd range.Signed-off-by Wei Yang <[email protected]>--- mm/khugepaged.c | 1 + 1 file changed, 1 insertion(+)mm/khugepaged.c +0
-0mm/khugepaged.c int madvise_collapse(struct vm_area_struct *vma, unsigned long start, · line 2841
Quoted 7 lines
mm/khugepaged.c +1
-0@@ -2835,6 +2835,7 @@ int madvise_collapse(struct vm_area_struct *vma, unsigned long start, goto handle_result;/* Whitelisted set of results where continuing OK */ case SCAN_PMD_NULL : +case SCAN_PMD_NONE :case SCAN_PTE_NON_PRESENT :case SCAN_PTE_UFFD_WP :case SCAN_LACK_REFERENCED_PAGE :Looks ok to me.
I am really confused about
PMD_NONEvs.PMD_NULL.Is my understanding correct, hat with your patch we can just merge both into a single
NO_PMD_TABLEor sth. like that?
Quoted 8 lines
Quoted 2 lines
NO_PTE_TABLE, actuallyI am thinking about this too.
If no other objections, I will prepare a v2 with this.
BTW, you prefer merge them directly, or merge on top of this change?
I'd probably do it in a single commit, stating that both scenarios should be handled completely the same.
But no strong opinion against doing it in two commits from my side.
Signature · 3 lines
Cheers David
Quoted 5 lines · Wei Yang
SCAN_PMD_NONEmeans current pmd is empty, but we can still continue collapse next pmd range.Signed-off-by Wei Yang <[email protected]>---
Make sense to me. And I agree with others' opinions to unify SCAN_PMD_NULL and SCAN_PMD_NONE.
Quoted 15 lines
mm/khugepaged.c | 1 + 1 file changed, 1 insertion(+)mm/khugepaged.c +1
-0@@ -2835,6 +2835,7 @@ int madvise_collapse(struct vm_area_struct *vma, unsigned long start, goto handle_result;/* Whitelisted set of results where continuing OK */ case SCAN_PMD_NULL : +case SCAN_PMD_NONE :case SCAN_PTE_NON_PRESENT :case SCAN_PTE_UFFD_WP :case SCAN_LACK_REFERENCED_PAGE :