Commit a9897798 authored by frobinet's avatar frobinet

BugFix: gNB main() thread shall be shared between at least 2 CPUs during initialization

parent a0eddd49
...@@ -1033,8 +1033,13 @@ int main( int argc, char **argv ) ...@@ -1033,8 +1033,13 @@ int main( int argc, char **argv )
char cpu_affinity[1024]; char cpu_affinity[1024];
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
#ifdef CPU_AFFINITY #ifdef CPU_AFFINITY
int j;
if (get_nprocs() > 2) { if (get_nprocs() > 2) {
CPU_SET(1, &cpuset); // CPU_SET(1, &cpuset);
for (j = 2; j < get_nprocs(); j++)
{
CPU_SET(j, &cpuset);
}
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0) { if (s != 0) {
perror( "pthread_setaffinity_np"); perror( "pthread_setaffinity_np");
......
...@@ -303,21 +303,9 @@ void thread_top_init(char *thread_name, ...@@ -303,21 +303,9 @@ void thread_top_init(char *thread_name,
#ifdef CPU_AFFINITY #ifdef CPU_AFFINITY
if (get_nprocs() > 2) if (get_nprocs() > 2)
{ {
if (affinity == 0) for (j = 2; j < get_nprocs(); j++)
{ {
printf("[SYRTEM CPU AFFINITY !!!] ERROR:affinity is 0 -> 2-7 !!!!!!!!!! !!!!!!!!!!\n"); CPU_SET(j, &cpuset);
// CPU_SET(0,&cpuset);
for (j = 2; j < get_nprocs(); j++)
{
CPU_SET(j, &cpuset);
}
}
else
{
for (j = 2; j < get_nprocs(); j++)
{
CPU_SET(j, &cpuset);
}
} }
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment