@@ -174,7 +174,9 @@ typedef struct qaeMemHeader {
174174 pthread_t threadId ;
175175#endif
176176 size_t size ;
177- int count ;
177+ word16 count ;
178+ word16 isNuma :1 ;
179+ word16 reservedBits :15 ; /* use for future bits */
178180 word16 type ;
179181 word16 numa_page_offset ; /* use QAE_NOT_NUMA_PAGE if not NUMA */
180182} ALIGN16 qaeMemHeader ;
@@ -240,8 +242,6 @@ static WC_INLINE int qaeMemTypeIsNuma(int type)
240242 case DYNAMIC_TYPE_ASYNC_NUMA :
241243 case DYNAMIC_TYPE_ASYNC_NUMA64 :
242244 case DYNAMIC_TYPE_WOLF_BIGINT :
243- case DYNAMIC_TYPE_OUT_BUFFER :
244- case DYNAMIC_TYPE_IN_BUFFER :
245245 case DYNAMIC_TYPE_PRIVATE_KEY :
246246 case DYNAMIC_TYPE_PUBLIC_KEY :
247247 case DYNAMIC_TYPE_AES_BUFFER :
@@ -256,7 +256,18 @@ static WC_INLINE int qaeMemTypeIsNuma(int type)
256256 isNuma = 1 ;
257257 break ;
258258 }
259+ case DYNAMIC_TYPE_OUT_BUFFER :
260+ case DYNAMIC_TYPE_IN_BUFFER :
261+ {
262+ #if !defined(WC_ASYNC_NO_CRYPT ) && !defined(WC_ASYNC_NO_HASH )
263+ isNuma = 1 ;
264+ #else
265+ isNuma = 0 ;
266+ #endif
267+ break ;
268+ }
259269 default :
270+ isNuma = 0 ;
260271 break ;
261272 }
262273 return isNuma ;
@@ -351,7 +362,7 @@ static void _qaeMemFree(void *ptr, void* heap, int type
351362#endif
352363
353364 /* free type */
354- if (header -> numa_page_offset != QAE_NOT_NUMA_PAGE ) {
365+ if (header -> isNuma && header -> numa_page_offset != QAE_NOT_NUMA_PAGE ) {
355366 #ifdef QAT_V2
356367 qaeMemFreeNUMA (& ptr );
357368 #else
@@ -397,7 +408,7 @@ static void* _qaeMemAlloc(size_t size, void* heap, int type
397408 alignment , & page_offset );
398409 #endif
399410 }
400- if (ptr == NULL ) {
411+ else if (ptr == NULL ) {
401412 isNuma = 0 ;
402413 ptr = malloc (size + sizeof (qaeMemHeader ));
403414 }
@@ -411,6 +422,7 @@ static void* _qaeMemAlloc(size_t size, void* heap, int type
411422 header -> size = size ;
412423 header -> type = type ;
413424 header -> count = 1 ;
425+ header -> isNuma = isNuma ;
414426 header -> numa_page_offset = page_offset ;
415427 #ifdef USE_QAE_THREAD_LS
416428 header -> threadId = pthread_self ();
0 commit comments