On Fri, Apr 26, 2019 at 12:45 AM Vlastimil Babka <vbabka@xxxxxxx> wrote: > > On 4/26/19 12:58 AM, Matthew Garrett wrote: > > Updated based on feedback from Jann - for now let's just prevent setting > > the flag on anything that has already mapped some pages, which avoids > > child processes being able to interfere with the parent. In addition, > > That makes the API quite tricky and different from existing madvise() > modes that don't care. One would for example have to call > madvise(MADV_WIPEONRELEASE) before mlock(), otherwise mlock() would > fault the pages in (unless MLOCK_ONFAULT). As such it really looks like > a mmap() flag, but that's less flexible. > > How bout just doing the CoW on any such pre-existing pages as part of > the madvise(MADV_WIPEONRELEASE) call? I'll look into the easiest way to do that.