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

Commit 93546c2e authored by Juan Yescas's avatar Juan Yescas
Browse files

CachedAppOptimizer: Remove PAGE_MASK usage

Android V will support page size agnostic targets. The bionic macro
PAGE_MASK won't be defined for the agnostic targets. For the CachedAppOptimizer,
the PAGE_MASK macro will be replaced by ~(getpagesize() - 1).

Bug: 296512786
Test: source build/envsetup.sh
      lunch aosp_cf_arm64_phone_pgagnostic
      m
Change-Id: Ic4c50dcb5e4eb4a8ce6460df240340868c76f252
parent d122f435
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@ using android::base::WriteStringToFile;
using android::meminfo::ProcMemInfo;
using namespace android::meminfo;

static const size_t kPageSize = getpagesize();
static const size_t kPageMask = ~(kPageSize - 1);

#define COMPACT_ACTION_FILE_FLAG 1
#define COMPACT_ACTION_ANON_FLAG 2

@@ -61,7 +64,7 @@ using android::base::unique_fd;
#define ASYNC_RECEIVED_WHILE_FROZEN (2)
#define TXNS_PENDING_WHILE_FROZEN (4)

#define MAX_RW_COUNT (INT_MAX & PAGE_MASK)
#define MAX_RW_COUNT (INT_MAX & kPageMask)

// Defines the maximum amount of VMAs we can send per process_madvise syscall.
// Currently this is set to UIO_MAXIOV which is the maximum segments allowed by
@@ -224,7 +227,6 @@ 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;