mbox series

[v4,0/3] mm/ksm: fix ksm exec support for prctl

Message ID 20240328111010.1502191-1-tujinjiang@huawei.com (mailing list archive)
Headers show
Series mm/ksm: fix ksm exec support for prctl | expand

Message

Jinjiang Tu March 28, 2024, 11:10 a.m. UTC
commit 3c6f33b7273a ("mm/ksm: support fork/exec for prctl") inherits
MMF_VM_MERGE_ANY flag when a task calls execve(). However, it doesn't
create the mm_slot, so ksmd will not try to scan this task. The first
patch fixes the issue.

The second patch refactors to prepare for the third patch. The third patch
extends the selftests of ksm to verfity the deduplication really happens
after fork/exec inherits ths KSM setting.

Changelog since v3:
  - collect Review-by tag.
  - refactor selftests.

Changelog since v2:
  - fix uninitialized warning reported by kernel test robot.
  - refactor selftests.

Changelog since v1:
  - Add ksm cleanup in __bprm_mm_init() when error occurs.
  - Add some comment.
  - Extend the selftests of ksm fork/exec.

Jinjiang Tu (3):
  mm/ksm: fix ksm exec support for prctl
  selftest/mm: ksm_functional_tests: refactor mmap_and_merge_range()
  selftest/mm: ksm_functional_tests: extend test case for ksm fork/exec

 fs/exec.c                                     |  11 ++
 include/linux/ksm.h                           |  13 ++
 .../selftests/mm/ksm_functional_tests.c       | 135 +++++++++++++-----
 3 files changed, 123 insertions(+), 36 deletions(-)