mirror of https://github.com/F-Stack/f-stack.git
some opt.
This commit is contained in:
parent
e45925dd79
commit
d3fabc9cef
|
@ -148,6 +148,7 @@ static uint64_t initial_lcore_id = INITIAL_LCORE_ID_DEFAULT;
|
|||
#define WORKER_ID_DEFAULT 0
|
||||
#define FF_PROC_ID_STR "FF_PROC_ID"
|
||||
static int worker_id = WORKER_ID_DEFAULT;
|
||||
static __thread int thread_id = 0;
|
||||
rte_spinlock_t worker_id_lock;
|
||||
|
||||
/* The num of F-Stack process instance, default 1 */
|
||||
|
@ -158,6 +159,7 @@ static int nb_procs = NB_FSTACK_INSTANCE_DEFAULT;
|
|||
#define FF_KERNEL_MAX_FD_DEFAULT 1024
|
||||
static int ff_kernel_max_fd = FF_KERNEL_MAX_FD_DEFAULT;
|
||||
|
||||
/* not support thread socket now */
|
||||
static int need_alarm_sem = 0;
|
||||
|
||||
static inline int convert_fstack_fd(int sockfd) {
|
||||
|
@ -1798,6 +1800,7 @@ ff_adapter_init()
|
|||
|
||||
pthread_setspecific(key, sc);
|
||||
|
||||
thread_id = worker_id;
|
||||
worker_id++;
|
||||
inited = 1;
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ void *loop(void *arg)
|
|||
close(clientfd);
|
||||
}
|
||||
} else {
|
||||
printf("unknown event: %8.8X\n", event.flags);
|
||||
printf("unknown event: %d:%8.8X\n", i, event.flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ void *loop(void *arg)
|
|||
close(events[i].data.fd);
|
||||
}
|
||||
} else {
|
||||
printf("unknown event: %8.8X\n", events[i].events);
|
||||
printf("unknown event: %d:%8.8X\n", i, events[i].events);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#define _GNU_SOURCE
|
||||
#include <sched.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -178,7 +180,7 @@ void *loop(void *arg)
|
|||
close(events[i].data.fd);
|
||||
}
|
||||
} else {
|
||||
printf("thread %d, unknown event: %8.8X\n", thread_id, events[i].events);
|
||||
printf("thread %d, unknown event: %d:%8.8X\n", thread_id, i, events[i].events);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -215,6 +217,19 @@ int main(int argc, char * argv[])
|
|||
pthread_spin_destroy(&worker_lock);
|
||||
return -1;
|
||||
}
|
||||
if (i > 0) {
|
||||
cpu_set_t cpuinfo;
|
||||
int lcore_id = 2 + i;
|
||||
|
||||
CPU_ZERO(&cpuinfo);
|
||||
CPU_SET_S(lcore_id, sizeof(cpuinfo), &cpuinfo);
|
||||
if(0 != pthread_setaffinity_np(hworker[i], sizeof(cpu_set_t), &cpuinfo))
|
||||
{
|
||||
printf("set affinity recver faild\n");
|
||||
exit(0);
|
||||
}
|
||||
printf("set affinity recver sucssed, thread:%d, lcore_id:%d\n", i, lcore_id);
|
||||
}
|
||||
pthread_spin_lock(&worker_lock);
|
||||
//sleep(1);
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ void *loop(void *arg)
|
|||
close(clientfd);
|
||||
}
|
||||
} else {
|
||||
printf("thread %d, unknown event: %8.8X\n", thread_id, event.flags);
|
||||
printf("thread %d, unknown event: %d:%8.8X\n", thread_id, i, event.flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue