Skip to content

Commit 2d0161a

Browse files
Copilotjkotas
andauthored
Exclude Android from CoreCLR NUMA syscalls
Co-authored-by: jkotas <[email protected]>
1 parent f9e3214 commit 2d0161a

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎src/coreclr/gc/unix/gcenv.unix.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ static bool VirtualCommitInner(void* address, size_t size, uint16_t node, bool n
463463
}
464464
#endif
465465

466-
#ifdef TARGET_LINUX
466+
#if defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
467467
if (success && g_numaAvailable && (node != NUMA_NODE_UNDEFINED))
468468
{
469469
if ((int)node <= g_highestNumaNode)
@@ -481,7 +481,7 @@ static bool VirtualCommitInner(void* address, size_t size, uint16_t node, bool n
481481
// If the mbind fails, we still return the allocated memory since the node is just a hint
482482
}
483483
}
484-
#endif // TARGET_LINUX
484+
#endif // TARGET_LINUX && !TARGET_ANDROID
485485

486486
return success;
487487
}
@@ -1344,14 +1344,14 @@ bool GCToOSInterface::GetProcessorForHeap(uint16_t heap_number, uint16_t* proc_n
13441344
if (availableProcNumber == heap_number)
13451345
{
13461346
*proc_no = procNumber;
1347-
#ifdef TARGET_LINUX
1347+
#if defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
13481348
if (GCToOSInterface::CanEnableGCNumaAware())
13491349
{
13501350
int result = GetNumaNodeNumByCpu(procNumber);
13511351
*node_no = (result >= 0) ? (uint16_t)result : NUMA_NODE_UNDEFINED;
13521352
}
13531353
else
1354-
#endif // TARGET_LINUX
1354+
#endif // TARGET_LINUX && !TARGET_ANDROID
13551355
{
13561356
*node_no = NUMA_NODE_UNDEFINED;
13571357
}

‎src/coreclr/gc/unix/numasupport.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <limits.h>
1313
#include <minipal/utils.h>
1414

15-
#ifdef TARGET_LINUX
15+
#if defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
1616
#include <sys/syscall.h>
1717
#endif
1818

@@ -21,7 +21,7 @@ int g_highestNumaNode = 0;
2121
// Is numa available
2222
bool g_numaAvailable = false;
2323

24-
#ifdef TARGET_LINUX
24+
#if defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
2525
static int GetNodeNum(const char* path, bool firstOnly)
2626
{
2727
DIR *dir;
@@ -56,7 +56,7 @@ static int GetNodeNum(const char* path, bool firstOnly)
5656

5757
void NUMASupportInitialize()
5858
{
59-
#ifdef TARGET_LINUX
59+
#if defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
6060
if (syscall(__NR_get_mempolicy, NULL, NULL, 0, 0, 0) < 0)
6161
return;
6262

@@ -72,7 +72,7 @@ void NUMASupportInitialize()
7272

7373
int GetNumaNodeNumByCpu(int cpu)
7474
{
75-
#ifdef TARGET_LINUX
75+
#if defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
7676
char path[64];
7777
if (snprintf(path, sizeof(path), "/sys/devices/system/cpu/cpu%d", cpu) < 0)
7878
return -1;
@@ -85,7 +85,7 @@ int GetNumaNodeNumByCpu(int cpu)
8585

8686
long BindMemoryPolicy(void* start, unsigned long len, const unsigned long* nodemask, unsigned long maxnode)
8787
{
88-
#ifdef TARGET_LINUX
88+
#if defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
8989
return syscall(__NR_mbind, (long)start, len, 1, (long)nodemask, maxnode, 0);
9090
#else
9191
return -1;

0 commit comments

Comments
 (0)