mbox series

[v4,0/2] mm: Fix checking unmapped holes for mbind

Message ID 1573218104-11021-1-git-send-email-lixinhai.lxh@gmail.com (mailing list archive)
Headers show
Series mm: Fix checking unmapped holes for mbind | expand

Message

Li Xinhai Nov. 8, 2019, 1:01 p.m. UTC
This patchset fix checking unmapped holes for mbind().

First patch makes sure the vma been correctly tracked in .test_walk(), 
so each time when .test_walk() is called, the neighborhood of two vma 
is correct.
Current problem is that the !vma_migratable() check could 
cause return immediately without update tracking to vma.

Second patch fix the inconsistent report of EFAULT when mbind() is 
called for MPOL_DEFAULT and non MPOL_DEFAULT cases, so application do 
not need to have workaround code to handle this special behavior.
Currently there are two problems, one is that the .test_walk() can not 
know there is hole at tail side of range, because .test_walk() only 
call for vma not for hole. The other one is that mbind_range() checks 
for hole at head side of range but do not consider the 
MPOL_MF_DISCONTIG_OK flag as done in .test_walk().

Changes v3->v4:
  - Split to two patch;
  - Illustrates the application visible behaviors in changelog;
  - Hole at tail side of range is checked in .test_walk(), not after 
    walk page. Only the case for whole range in hole is checked after 
    walk page, because our .test_walk() function would not be called at 
    all in this case.

Changes v2->v3:
  - Add more details in change log;
  - Check holes in .test_walk() and after call walk_page_range();

Li Xinhai (2):
  mm: Check range first in queue_pages_test_walk
  mm: Fix checking unmapped holes for mbind

 mm/mempolicy.c | 47 +++++++++++++++++++++++++++++++----------------
 1 file changed, 31 insertions(+), 16 deletions(-)