Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1709957

Re: [PATCH 2/2] mm,fork: introduce MADV_WIPEONFORK

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] mm,fork: introduce MADV_WIPEONFORK
Date 2017-08-11 23:00 +0200
Message-ID <udpcd-8cU-3@gated-at.bofh.it> (permalink)
References <udnDs-7se-19@gated-at.bofh.it> <udnN8-7vf-9@gated-at.bofh.it> <udo6t-7Bx-1@gated-at.bofh.it> <udoJb-83l-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Aug 11, 2017 at 1:27 PM, Rik van Riel <riel@redhat.com> wrote:
>>
>> Yes, you don't do the page table copies. Fine. But you leave vma with
>> the the anon_vma pointer - doesn't that mean that it's still
>> connected
>> to the original anonvma chain, and we might end up swapping something
>> in?
>
> Swapping something in would require there to be a swap entry in
> the page table entries, which we are not copying, so this should
> not be a correctness issue.

Yeah, I thought the rmap code just used the offset from the start to
avoid even doing swap entries, but I guess we don't actually ever
populate the page tables without the swap entry being there.

> There is another test in copy_page_range already which ends up
> skipping the page table copy when it should not be done.

Well, the VM_DONTCOPY test is in dup_mmap(), and I think I'd rather
match up the VM_WIPEONFORK logic with VM_DONTCOPY than with the
copy_page_range() tests.

Because I assume you are talking about the "if it's a shared mapping,
we don't need to copy the page tables and can just do it at page fault
time instead" part? That's a rather different thing, which isn't so
much about semantics, as about just a trade-off about when to touch
the page tables.

But yes, that one *might* make sense in dup_mmap() too. I just don't
think it's really analogous to the WIPEONFORK and DONTCOPY tests.

                      Linus

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/2] mm,fork,security: introduce MADV_WIPEONFORK riel@redhat.com - 2017-08-11 21:30 +0200
  [PATCH 2/2] mm,fork: introduce MADV_WIPEONFORK riel@redhat.com - 2017-08-11 21:30 +0200
    Re: [PATCH 2/2] mm,fork: introduce MADV_WIPEONFORK Linus Torvalds <torvalds@linux-foundation.org> - 2017-08-11 21:50 +0200
      Re: [PATCH 2/2] mm,fork: introduce MADV_WIPEONFORK Rik van Riel <riel@redhat.com> - 2017-08-11 22:30 +0200
        Re: [PATCH 2/2] mm,fork: introduce MADV_WIPEONFORK Linus Torvalds <torvalds@linux-foundation.org> - 2017-08-11 23:00 +0200

csiph-web