소스 검색

Correct the enclave maximum heap computation

Previously, a bug resulted in passing IDI=12 instead of 1, so memory was
being overallocated.  When that was fixed, memory was then being
underallocated.  This patch more carefully computes the heap space
needed.
Ian Goldberg 8 달 전
부모
커밋
ce657d2594
1개의 변경된 파일7개의 추가작업 그리고 6개의 파일을 삭제
  1. 7 6
      gen_enclave_config.py

+ 7 - 6
gen_enclave_config.py

@@ -38,19 +38,20 @@ def get_heap_size(N, M, T, B, TOKEN_CHANNEL=True, TOKO=1, TOKI=1, IDO=1, IDI=1,
     if not TOKEN_CHANNEL:
         num_in_mult = IDI
 
-    # Storage and Ingestion data stored per_client = 52 bytes
-    heap_size += clients_per_server * (B + 60)
+    # Storage and Ingestion data stored per_client
+    heap_size += clients_per_server * 100
+    heap_size += (clients_per_server + M * M) * (B+8)
 
     # 2 Buffers of clients_per_server items of B size each, plus 1 of
-    # size (clients_per_server + M) items, for token channel routing
+    # size (clients_per_server + M * M) items, for token channel routing
     heap_size += (clients_per_server * B * 2) * num_out_mult
-    heap_size += ((clients_per_server + M) * B) * num_in_mult
+    heap_size += ((clients_per_server + M * M) * B) * num_in_mult
 
     # Additional buffers for ID channel routing
 
     # Round (M-1)^2 up to a multiple of M
     round1b_size = (M-1)*M
-    wn_size = max(clients_per_server, 2*round1b_size)
+    wn_size = max(clients_per_server + M*M, 2*round1b_size)
     # Round up to a multiple of M
     colsort_size = int((wn_size + M - 1) / M) * M
 
@@ -59,7 +60,7 @@ def get_heap_size(N, M, T, B, TOKEN_CHANNEL=True, TOKO=1, TOKI=1, IDO=1, IDI=1,
 
     # num_WN_to_precompute times size of each WN
     heap_size += (num_WN_to_precompute * num_out_mult * \
-        (wn_size * math.ceil(math.log(wn_size,2) + 1) * 8))
+        (wn_size * math.ceil(math.log(wn_size,2) + 1) * 9))
 
     heap_size_page_aligned = math.ceil(heap_size/4096) * 4096
     return heap_size_page_aligned