summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-12-16 14:35:16 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-12-16 14:35:16 -0800
commit1b678528237d4eea623840ce3ba5520c59ca4b2c (patch)
treeefdcb8d7bcfbdde7962d153721b88e9206f5588a /libs
parentcca5b116dbf05942fae0fa4fedd278c8b2e84c19 (diff)
parentc17d9b75b636e2db164ec4213252b06cfb474924 (diff)
downloadframeworks_base-1b678528237d4eea623840ce3ba5520c59ca4b2c.zip
frameworks_base-1b678528237d4eea623840ce3ba5520c59ca4b2c.tar.gz
frameworks_base-1b678528237d4eea623840ce3ba5520c59ca4b2c.tar.bz2
Merge "Fix invalid madvise() during concurrent alloc/dealloc of MemoryDealer"
Diffstat (limited to 'libs')
-rw-r--r--libs/binder/MemoryDealer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/binder/MemoryDealer.cpp b/libs/binder/MemoryDealer.cpp
index 18669f7..fc3e31e 100644
--- a/libs/binder/MemoryDealer.cpp
+++ b/libs/binder/MemoryDealer.cpp
@@ -180,7 +180,6 @@ Allocation::~Allocation()
/* NOTE: it's VERY important to not free allocations of size 0 because
* they're special as they don't have any record in the allocator
* and could alias some real allocation (their offset is zero). */
- mDealer->deallocate(freedOffset);
// keep the size to unmap in excess
size_t pagesize = getpagesize();
@@ -216,6 +215,11 @@ Allocation::~Allocation()
}
#endif
}
+
+ // This should be done after madvise(MADV_REMOVE), otherwise madvise()
+ // might kick out the memory region that's allocated and/or written
+ // right after the deallocation.
+ mDealer->deallocate(freedOffset);
}
}