This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Support for Intel X1000


Hi Rich,

I completed the prototype using ld_preload and it works well at the
expense of over-provisioning memory. To catch all cases, it turns out
you need to enforce mlockall both at pre-init and fork, as large
data-segments are also faulted into memory. 

I also tried implementing a more conservative scheme using maps to
figure out the data segments/heap/stack etc so that not everything had
to be mlock'ed but found the benefit to be marginal. 

The simplest kernel level fix is going to be call mlockall(MCL_FUTURE)
at process initialization and at fork ... 

Ray K


On Tue, 2015-05-26 at 14:48 -0400, dalias@libc.org wrote:
> On Tue, May 26, 2015 at 04:32:26PM +0000, Kinsella, Ray wrote:
> > > Is there any known way to change this behavior and eliminate the CoW?
> > 
> > Apologies - to answer my own question ...
> > 
> > "Memory locks are not inherited by a child created via fork(2) and are
> > automatically removed (unlocked) during an execve(2) or when the process
> > terminates. The mlockall() MCL_FUTURE setting is not inherited by a
> > child created via fork(2) and is cleared during an execve(2)."
> > 
> > mlockall(MCL_CURRENT) after the fork,  triggers the CoW upfront.
> 
> Excellent. In a kernel-based workaround, the kernel would enforce
> adding the mlockall at fork time, and then running arbitrary binaries
> would be safe.
> 
> Rich


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]