mm/mempolicy: Move VMA address bound checks inside mpol_misplaced()
Subsystems (2)
PATCH 1/1 mm/mempolicy: Move VMA address bound checks inside mpol_misplaced()
The VMA address bound checks are applicable to all memory policy modes, not just MPOL_INTERLEAVE. Hence move it to the front and make it common.
--- mm/mempolicy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
mm/mempolicy.c +2 -3
@@ -2173,6 +2173,8 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned longint ret =-1 ;BUG_ON (!vma); +BUG_ON (addr >= vma->vm_end); +BUG_ON (addr < vma->vm_start); pol =get_vma_policy (vma, addr);if (!(pol->flags &MPOL_F_MOF ))
@@ -2180,9 +2182,6 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned longswitch (pol->mode) {case MPOL_INTERLEAVE : -BUG_ON (addr >= vma->vm_end); -BUG_ON (addr < vma->vm_start); - pgoff = vma->vm_pgoff; pgoff += (addr - vma->vm_start) >>PAGE_SHIFT ; polnid =offset_il_node (pol, vma, pgoff);
Signature · 7 lines
1.8.5.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 2 lines · Anshuman Khandual
The VMA address bound checks are applicable to all memory policy modes, not just
MPOL_INTERLEAVE.
But only MPOL_INTERLEAVE actually uses addr and vma->vm_start.
Quoted 3 lines
Hence move it to the front and make it common.
Signed-off-by Anshuman Khandual <[email protected]>
I would just remove them instead. Together with the BUG_ON(!vma). Looks like just leftover from development.
Quoted 19 lines
--- mm/mempolicy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)mm/mempolicy.c +2
-0@@ -2173,6 +2173,8 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned longint ret =-1 ;BUG_ON (!vma); +BUG_ON (addr >= vma->vm_end); +BUG_ON (addr < vma->vm_start); pol =get_vma_policy (vma, addr);if (!(pol->flags &MPOL_F_MOF ))
mm/mempolicy.c int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long · line 2187
Quoted 9 lines
mm/mempolicy.c +0
-3@@ -2180,9 +2182,6 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned longswitch (pol->mode) {case MPOL_INTERLEAVE : -BUG_ON (addr >= vma->vm_end); -BUG_ON (addr < vma->vm_start); - pgoff = vma->vm_pgoff; pgoff += (addr - vma->vm_start) >>PAGE_SHIFT ; polnid =offset_il_node (pol, vma, pgoff);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Vlastimil Babka
Quoted 2 lines · Anshuman Khandual
The VMA address bound checks are applicable to all memory policy modes, not just
MPOL_INTERLEAVE.But only
MPOL_INTERLEAVEactually uses addr andvma->vm_start.
I thought them to be just general sanity checks.
Quoted 7 lines
Quoted 4 lines
Hence move it to the front and make it common.
Signed-off-by Anshuman Khandual <[email protected]>I would just remove them instead. Together with the
BUG_ON(!vma). Looks like just leftover from development.
sure, resend with suggested changes.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Anshuman Khandual
Quoted 5 lines · Vlastimil Babka
Quoted 2 lines · Anshuman Khandual
The VMA address bound checks are applicable to all memory policy modes, not just
MPOL_INTERLEAVE.But only
MPOL_INTERLEAVEactually uses addr andvma->vm_start.I thought them to be just general sanity checks.
Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Hence move it to the front and make it common.
Signed-off-by Anshuman Khandual <[email protected]>I would just remove them instead. Together with the
BUG_ON(!vma). Looks like just leftover from development.sure, resend with suggested changes.
I meant, I will resend the patch with suggested changes.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 1/1 mm/mempolicy: Remove BUG_ON() checks for VMA inside mpol_misplaced()
VMA and its address bounds checks are too late in this function. They must have been verified earlier in the page fault sequence. Hence just remove them.
--- mm/mempolicy.c | 5 ----- 1 file changed, 5 deletions(-)
mm/mempolicy.c +0 -5
@@ -2172,17 +2172,12 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned longint polnid =-1 ;int ret =-1 ; -BUG_ON (!vma); - pol =get_vma_policy (vma, addr);if (!(pol->flags &MPOL_F_MOF )) goto out;switch (pol->mode) {case MPOL_INTERLEAVE : -BUG_ON (addr >= vma->vm_end); -BUG_ON (addr < vma->vm_start); - pgoff = vma->vm_pgoff; pgoff += (addr - vma->vm_start) >>PAGE_SHIFT ; polnid =offset_il_node (pol, vma, pgoff);
Signature · 7 lines
1.8.5.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH] mm/mempolicy: Remove BUG_ON() checks for VMA inside mpol_misplaced()
Quoted 6 lines · Anshuman Khandual
VMA and its address bounds checks are too late in this function. They must have been verified earlier in the page fault sequence. Hence just remove them.
Suggested-by Vlastimil Babka <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>
Quoted 17 lines
--- mm/mempolicy.c | 5 ----- 1 file changed, 5 deletions(-)mm/mempolicy.c +0
-2@@ -2172,17 +2172,12 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned longint polnid =-1 ;int ret =-1 ; -BUG_ON (!vma); - pol =get_vma_policy (vma, addr);if (!(pol->flags &MPOL_F_MOF ))
mm/mempolicy.c int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long · line 2183
Quoted 10 lines
mm/mempolicy.c +0
-3goto out;switch (pol->mode) {case MPOL_INTERLEAVE : -BUG_ON (addr >= vma->vm_end); -BUG_ON (addr < vma->vm_start); - pgoff = vma->vm_pgoff; pgoff += (addr - vma->vm_start) >>PAGE_SHIFT ; polnid =offset_il_node (pol, vma, pgoff);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>