Commit c1b8c6a9 authored by laurent's avatar laurent

new thread model - make affinity optional

parent 1f134370
......@@ -10,6 +10,8 @@
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/sysinfo.h>
#include <threadPool/thread-pool.h>
void displayList(notifiedFIFO_t *nf) {
......@@ -46,12 +48,16 @@ static inline notifiedFIFO_elt_t *pullNotifiedFifoRemember( notifiedFIFO_t *nf,
void *one_thread(void *arg) {
struct one_thread *myThread=(struct one_thread *) arg;
struct thread_pool *tp=myThread->pool;
// configure the thread core assignment
// TBD: reserve the core for us exclusively
if ( myThread->coreID >= 0 && myThread->coreID < get_nprocs_conf()) {
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(myThread->coreID, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
}
//Configure the thread scheduler policy for Linux
struct sched_param sparam= {0};
sparam.sched_priority = sched_get_priority_max(SCHED_RR);
......@@ -112,22 +118,27 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
curptr=strtok_r(params,",",&saveptr);
while ( curptr!=NULL ) {
if (curptr[0] == 'u' || curptr[0] == 'U') {
int c=toupper(curptr[0]);
switch (c) {
case 'U':
pool->restrictRNTI=true;
} else if ( curptr[0]>='0' && curptr[0]<='9' ) {
struct one_thread *tmp=pool->allthreads;
break;
case 'N':
pool->activated=false;
break;
default:
pool->allthreads=(struct one_thread *)malloc(sizeof(struct one_thread));
pool->allthreads->next=tmp;
pool->allthreads->next=pool->allthreads;
printf("create a thread for core %d\n", atoi(curptr));
pool->allthreads->coreID=atoi(curptr);
pool->allthreads->id=pool->nbThreads;
pool->allthreads->pool=pool;
pthread_create(&pool->allthreads->threadID, NULL, one_thread, (void *)pool->allthreads);
pool->nbThreads++;
} else if (curptr[0] == 'n' || curptr[0] == 'N') {
pool->activated=false;
} else
printf("Error in options for thread pool: %s\n",curptr);
}
curptr=strtok_r(NULL,",",&saveptr);
}
......
......@@ -19,16 +19,6 @@
* contact@openairinterface.org
*/
/*! \file lte-ue.c
* \brief threads and support functions for real-time LTE UE target
* \author R. Knopp, F. Kaltenberger, Navid Nikaein
* \date 2015
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr
* \note
* \warning
*/
#include "executables/nr-uesoftmodem.h"
#include "LAYER2/NR_MAC_UE/mac.h"
......@@ -141,10 +131,6 @@ typedef enum {
si=2
} sync_mode_t;
int32_t **rxdata;
int32_t **txdata;
#define KHz (1000UL)
#define MHz (1000*KHz)
typedef struct eutra_band_s {
......
......@@ -709,7 +709,7 @@ int main( int argc, char **argv ) {
set_taus_seed (0);
tpool_t pool;
Tpool = &pool;
char params[]="1,2,3,u";
char params[]="-1,-1,-1,-1";
initTpool(params, Tpool, false);
cpuf=get_cpu_freq_GHz();
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
......
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