summaryrefslogtreecommitdiff
path: root/smalloc.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-06-18 15:30:09 -0700
committerMohamad Ayyash <mkayyash@google.com>2015-03-06 17:57:08 -0800
commitef7035a9b2c7af1e745b7cd2448685527ef7eeb0 (patch)
tree310e35ae5474f922876186d956d68a22d253a416 /smalloc.c
parent41bfff8cb4c48f7229c67cb3b71b0b5fc88dca55 (diff)
downloadfio-ef7035a9b2c7af1e745b7cd2448685527ef7eeb0.tar.gz
Add support for compiling for ESX
With contributions from Ryan Haynes <rhaynes@fusionio.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'smalloc.c')
-rw-r--r--smalloc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/smalloc.c b/smalloc.c
index c8f1642e..d0f732ba 100644
--- a/smalloc.c
+++ b/smalloc.c
@@ -180,6 +180,7 @@ static int find_next_zero(int word, int start)
static int add_pool(struct pool *pool, unsigned int alloc_size)
{
int bitmap_blocks;
+ int mmap_flags;
void *ptr;
#ifdef SMALLOC_REDZONE
@@ -198,8 +199,14 @@ static int add_pool(struct pool *pool, unsigned int alloc_size)
pool->nr_blocks = bitmap_blocks;
pool->free_blocks = bitmap_blocks * SMALLOC_BPB;
- ptr = mmap(NULL, alloc_size, PROT_READ|PROT_WRITE,
- MAP_SHARED | OS_MAP_ANON, -1, 0);
+ mmap_flags = OS_MAP_ANON;
+#ifdef CONFIG_ESX
+ mmap_flags |= MAP_PRIVATE;
+#else
+ mmap_flags |= MAP_SHARED;
+#endif
+ ptr = mmap(NULL, alloc_size, PROT_READ|PROT_WRITE, mmap_flags, -1, 0);
+
if (ptr == MAP_FAILED)
goto out_fail;