From: Simon Guo <wei.guo.simon@xxxxxxxxx> This patch set fixes some mlock() misbehavior when mlock()/mlock2() is invoked multiple times on intersect or same address regions. And add selftest for this case. Simon Guo (4): mm: mlock: check against vma for actual mlock() size mm: mlock: avoid increase mm->locked_vm on mlock() when already mlock2(,MLOCK_ONFAULT) selftest: split mlock2_ apis into separate mlock2.h selftests/vm: add test for mlock() when areas are intersected. mm/mlock.c | 53 ++++++++++++++++ tools/testing/selftests/vm/.gitignore | 1 + tools/testing/selftests/vm/Makefile | 4 ++ tools/testing/selftests/vm/mlock-intersect-test.c | 76 +++++++++++++++++++++++ tools/testing/selftests/vm/mlock2-tests.c | 21 +------ tools/testing/selftests/vm/mlock2.h | 21 +++++++ 6 files changed, 156 insertions(+), 20 deletions(-) create mode 100644 tools/testing/selftests/vm/mlock-intersect-test.c create mode 100644 tools/testing/selftests/vm/mlock2.h -- 1.8.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>