pthread wastes memory with mlockall(MCL_FUTURE)

Balazs Kezes rlblaster@gmail.com
Fri Sep 18 16:38:00 GMT 2015


On 2015-09-18 10:38 -0400, Rich Felker wrote:
> I would say it's a kernel bug for PROT_NONE pages to actually occupy
> resources when locked, if they actually do?

It could make sense that you have some pages with some data in them but
in a later stage you remove the permissions to trap data accesses. I
think some debuggers (e.g. watchpoints) or some cache simulators work
this way.

> How did you test/measure this?

There's a pthread_attr_setguardsize function. Basically I've set it to
large (to expand the effect of this behavior) and then created a bunch
of threads and checked what happens. I could try to create a simple
repro if needed.

-- 
Balazs



More information about the Libc-alpha mailing list