Page MenuHomeSoftware Heritage

pid: use PROT_READ/MAP_SHARED for readonly maps
ClosedPublic

Authored by seirl on Jul 23 2020, 12:22 PM.

Details

Summary

We used to have PROT_READ | PROT_WRITE and MAP_PRIVATE for readonly
maps. However, this would reserve copy-on-write space and make the
service OOM. We could also use MAP_NORESERVE to avoid committing for
that much memory in advance, but we really don't need to have writable
space at all, so we just set the prot flags properly.

Fix T2492

Test Plan

tested in prod

Diff Detail

Repository
rDGRPH Compressed graph representation
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

This revision is now accepted and ready to land.Jul 23 2020, 12:23 PM

Build is green

Patch application report for D3599 (id=12678)

Rebasing onto 481fcc9fc0...

Current branch diff-target is up to date.
Changes applied before test
commit 39430074227cf35d51eeccfde8e151c0aa1e257a
Author: Antoine Pietri <antoine.pietri1@gmail.com>
Date:   Thu Jul 23 12:17:18 2020 +0200

    pid: use PROT_READ/MAP_SHARED for readonly maps
    
    We used to have PROT_READ | PROT_WRITE and MAP_PRIVATE for readonly
    maps. However, this would reserve copy-on-write space and make the
    service OOM. We could also use MAP_NORESERVE to avoid committing for
    that much memory in advance, but we really don't need to have writable
    space at all, so we just set the prot flags properly.
    
    Fix T2492

See https://jenkins.softwareheritage.org/job/DGRPH/job/tests-on-diff/10/ for more details.