]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.1.0/test_and_benchmark/benchmark/src/porting_abstraction_layer_numa_free.c
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.1.0 / test_and_benchmark / benchmark / src / porting_abstraction_layer_numa_free.c
1 /***** includes *****/
2 #include "internal.h"
3
4
5
6
7
8 /****************************************************************************/
9 #if( defined _WIN32 && !defined KERNEL_MODE && NTDDI_VERSION >= NTDDI_WINXP )
10
11   #pragma warning( disable : 4100 )
12
13   void benchmark_pal_numa_free( void *memory, lfds710_pal_uint_t size_in_bytes )
14   {
15     HANDLE
16       process_handle;
17
18     assert( memory != NULL );
19     // TRD : size_in_bytes can be any value in its range
20
21     process_handle = GetCurrentProcess();
22
23     VirtualFreeEx( process_handle, memory, 0, MEM_RELEASE );
24
25     return;
26   }
27
28   #pragma warning( default : 4100 )
29
30 #endif
31
32
33
34
35
36 /****************************************************************************/
37 #if( defined __linux__ && defined LIBNUMA )
38
39   #ifdef BENCHMARK_PAL_NUMA_FREE
40     #error More than one porting abstraction layer matches the current platform in porting_abstraction_free.c
41   #endif
42
43   #define BENCHMARK_PAL_NUMA_FREE
44
45   void benchmark_pal_numa_free( void *memory, lfds710_pal_uint_t size_in_bytes )
46   {
47     assert( memory != NULL );
48     // TRD : size_in_bytes can be any value in its range
49
50     #if( defined _POSIX_MEMLOCK_RANGE > 0 )
51       munlock( memory, size_in_bytes );
52     #endif
53
54     numa_free( memory, size_in_bytes );
55
56     return;
57   }
58
59 #endif
60