From 444083bdcebed2a238955e833d64a6ecafb3ce65 Mon Sep 17 00:00:00 2001 From: Dmitrii Kuvaiskii Date: Tue, 4 Aug 2020 16:58:11 +0000 Subject: [PATCH] [Pal/Linux-SGX] Remove redundant memset in _DkVirtualMemoryAlloc() There is already one memset in get_enclave_pages() controlled by manifest option `sgx.zero_heap_on_demand`. So the explicit memset in _DkVirtualMemoryAlloc() is not needed. Observed perf improvement is 30% on a worst-case micro-benchmark with mmap(). --- Pal/src/host/Linux-SGX/db_memory.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/Pal/src/host/Linux-SGX/db_memory.c b/Pal/src/host/Linux-SGX/db_memory.c index 6b9e57e8..0002b6b2 100644 --- a/Pal/src/host/Linux-SGX/db_memory.c +++ b/Pal/src/host/Linux-SGX/db_memory.c @@ -54,8 +54,6 @@ int _DkVirtualMemoryAlloc(void** paddr, uint64_t size, int alloc_type, int prot) if (!mem) return addr ? -PAL_ERROR_DENIED : -PAL_ERROR_NOMEM; - memset(mem, 0, size); - *paddr = mem; return 0; }