Fix GuardPageAllocator to do mprotect lazily
authorAndrii Grynenko <andrii@fb.com>
Thu, 14 Apr 2016 04:30:45 +0000 (21:30 -0700)
committerFacebook Github Bot 1 <facebook-github-bot-1-bot@fb.com>
Thu, 14 Apr 2016 04:35:22 +0000 (21:35 -0700)
commita6692f12f127e17f97fedfd17ff2c7116f34eb51
treea4448100bd8108cb252d128bf1c3a0881bc38117
parent7c17b38a91cd376968a8d85c23dc86a9460cc105
Fix GuardPageAllocator to do mprotect lazily

Summary:Currently GuargPageAllocator mmap's a memory block enough for 100 fiber stacks and then protects a bottom page for each stack. If FiberManager is used to process a single task, protecting 100 stacks doesn't make much sense, but is costly.

This change makes sure we protect a bottom page of every stack the first time given stack is requested.

Reviewed By: alikhtarov

Differential Revision: D3139944

fb-gh-sync-id: d9d724eaa0e65a227eac1d09a33018e6cb098aae
fbshipit-source-id: d9d724eaa0e65a227eac1d09a33018e6cb098aae
folly/experimental/fibers/GuardPageAllocator.cpp
folly/experimental/fibers/test/FibersTest.cpp