diff options
author | Peter Xu <peterx@redhat.com> | 2020-09-26 01:26:00 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-09-27 21:21:35 +0300 |
commit | d042035eaf5f9009ad927dc4d3ce848381ccdeed (patch) | |
tree | 8285680a75032f8a6e766c5e6813ce32dfd70bba /fs/jffs2/compr.h | |
parent | 70e806e4e645019102d0e09d4933654fb5fb58ce (diff) | |
download | linux-d042035eaf5f9009ad927dc4d3ce848381ccdeed.tar.xz |
mm/thp: Split huge pmds/puds if they're pinned when fork()
Pinned pages shouldn't be write-protected when fork() happens, because
follow up copy-on-write on these pages could cause the pinned pages to
be replaced by random newly allocated pages.
For huge PMDs, we split the huge pmd if pinning is detected. So that
future handling will be done by the PTE level (with our latest changes,
each of the small pages will be copied). We can achieve this by let
copy_huge_pmd() return -EAGAIN for pinned pages, so that we'll
fallthrough in copy_pmd_range() and finally land the next
copy_pte_range() call.
Huge PUDs will be even more special - so far it does not support
anonymous pages. But it can actually be done the same as the huge PMDs
even if the split huge PUDs means to erase the PUD entries. It'll
guarantee the follow up fault ins will remap the same pages in either
parent/child later.
This might not be the most efficient way, but it should be easy and
clean enough. It should be fine, since we're tackling with a very rare
case just to make sure userspaces that pinned some thps will still work
even without MADV_DONTFORK and after they fork()ed.
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/jffs2/compr.h')
0 files changed, 0 insertions, 0 deletions