Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
[Pal/Linux-SGX] EDMM Lazy free optimization
Browse files Browse the repository at this point in the history
This optimization keeps track of free EPC pages and
lazily frees them when the amount of EPC that is not freed
exceeds a certain threshold that is set from the manifest
file `sgx.edmm_lazyfree_th`. This optimization reduces enclave
exists and at the same time doesn't hog EPC pages that aren't
required anymore.

Signed-off-by: Vijay Dhanraj <[email protected]>
  • Loading branch information
vijaydhanraj committed Oct 4, 2021
1 parent dff9504 commit cd355a1
Show file tree
Hide file tree
Showing 11 changed files with 496 additions and 171 deletions.
13 changes: 13 additions & 0 deletions Documentation/manifest-syntax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,19 @@ the pages requested.
New SGX driver IOCTL is experimental and is not yet available as part of official
Intel SGX OOT driver release. This option is not yet ready for public usage.
EDMM Lazy Free optimization (Experimental)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

::

sgx.edmm_lazyfree_th = [NUM]
(Default: 0)

This syntax specifies the **percentage** of total heap that can be freed in a lazy manner.
Until this threshold is met, graphene doesn't release any dynamically allocated memory.
This optimization helps reduce the expensive enclave entries/exits associated with dynamic
freeing of EPC pages.

Optional CPU features (AVX, AVX512, MPX, PKRU)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
1 change: 1 addition & 0 deletions Pal/src/host/Linux-SGX/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ enclave-objs = \
db_sockets.o \
db_streams.o \
db_threading.o \
edmm_pages.o \
enclave_ecalls.o \
enclave_framework.o \
enclave_ocalls.o \
Expand Down
3 changes: 3 additions & 0 deletions Pal/src/host/Linux-SGX/db_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,9 @@ noreturn void pal_linux_main(char* uptr_libpal_uri, size_t libpal_uri_len, char*
/* Extract the mmap'd region to share addr and number of EPC pages requested with driver. */
g_pal_sec.eaug_base = sec_info.eaug_base;

/* Extract enclave heap lazy free threshold */
g_pal_sec.edmm_lazyfree_th = sec_info.edmm_lazyfree_th;

/* For {p,u,g}ids we can at least do some minimal checking. */

/* ppid should be positive when interpreted as signed. It's 0 if we don't
Expand Down
Loading

0 comments on commit cd355a1

Please sign in to comment.