Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6102197 authored by Kalesh Singh's avatar Kalesh Singh
Browse files

CachedAppOptimizer: Remove use of hardcoded PAGE_SIZE 4096



bionic hard codes the PAGE_SIZE macro as 4096. This is going away as
Android begins to support larger page sizes. Remove the usage of this
assumption from CachedAppOptimizer source; use instead getpagesize()
which provides the real pagesize.

Test: mma
Bug: 295082310
Change-Id: I2adc60ffa38bd23442a08cbd80b68f0158057c5e
Signed-off-by: default avatarKalesh Singh <kaleshsingh@google.com>
parent 1e44213d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -224,6 +224,7 @@ public:
// process_madvise on failure
int madviseVmasFromBatch(unique_fd& pidfd, VmaBatch& batch, int madviseType,
                         uint64_t* outBytesProcessed) {
    static const size_t kPageSize = getpagesize();
    if (batch.totalVmas == 0 || batch.totalBytes == 0) {
        // No VMAs in Batch, skip.
        *outBytesProcessed = 0;
@@ -249,7 +250,7 @@ int madviseVmasFromBatch(unique_fd& pidfd, VmaBatch& batch, int madviseType,
    } else if (bytesProcessedInSend < batch.totalBytes) {
        // Partially processed the bytes requested
        // skip last page which is where it failed.
        bytesProcessedInSend += PAGE_SIZE;
        bytesProcessedInSend += kPageSize;
    }
    bytesProcessedInSend = consumeBytes(batch, bytesProcessedInSend);